Browse Source

unit_tests: github_actions: add tox py3 run

Added github actions run for Python 3.8-3.11 with working
test-requirements.txt.
Adrian Vladu 2 years ago
parent
commit
dfd35aeee9
4 changed files with 52 additions and 37 deletions
  1. 18 8
      .github/workflows/unit-tests.yml
  2. 3 0
      .stestr.conf
  3. 9 6
      test-requirements.txt
  4. 22 23
      tox.ini

+ 18 - 8
.github/workflows/unit-tests.yml

@@ -10,15 +10,25 @@ permissions:
 
 jobs:
   build:
-
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
+    strategy:
+      matrix:
+        python-version: ["3.8", "3.9", "3.10", "3.11"]
+        architecture: ["x64"]
 
     steps:
-    - uses: actions/checkout@v3
-    - name: Install dependencies
+    - name: Checkout repository
+      uses: actions/checkout@v4
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v4
+      with:
+        python-version: ${{ matrix.python-version }}
+        architecture: ${{ matrix.architecture }}
+    - name: Install python3 tox
+      shell: bash
       run: |
-        pip install -r requirements.txt
-        pip install -r test-requirements.txt
-    - name: Run unit tests
+        python3 -m pip install tox
+    - name: Run unit tests with tox
+      shell: bash
       run: |
-        python -m nose -v --nocapture --logging-level=ERROR coriolis/tests
+        tox -e py3 -v

+ 3 - 0
.stestr.conf

@@ -0,0 +1,3 @@
+[DEFAULT]
+test_path=${OS_TEST_PATH:-./coriolis/tests}
+top_dir=./

+ 9 - 6
test-requirements.txt

@@ -1,7 +1,10 @@
-coverage
-ddt
-discover
-nose
-oslotest
+# The order of packages is significant, because pip processes them in the order
+# of appearance. Changing the order has an impact on the overall integration
+# process, which may cause wedges in the gate later.
+
+hacking>=6.0.1,<=6.0.1 # Apache-2.0
+coverage!=4.4,>=4.0 # Apache-2.0
+ddt>=1.2.1 # MIT
+oslotest>=3.8.0 # Apache-2.0
+stestr>=2.0.0 # Apache-2.0
 
-hacking>=0.12.0,<0.13 # Apache-2.0

+ 22 - 23
tox.ini

@@ -1,37 +1,36 @@
 [tox]
-minversion = 2.0
-envlist = py35,py27,pep8
+minversion = 4.0.2
+envlist = py3,pep8,flake8,cover
 skipsdist = True
 
 [testenv]
 usedevelop = True
-whitelist_externals = rm
-install_command = pip install {opts} {packages}
-setenv =
-   VIRTUAL_ENV={envdir}
-   BRANCH_NAME=master
-   CLIENT_NAME=coriolis-core
-   DEFAULT_REPO=git@bitbucket.org:cloudbase
-   PYTHONWARNINGS=default::DeprecationWarning
-deps = -r{toxinidir}/requirements.txt
-       -r{toxinidir}/test-requirements.txt
-commands =
-  python setup.py test --slowest --testr-args='{posargs}'
-  rm -f .testrepository/times.dbm
+setenv = VIRTUAL_ENV={envdir}
+deps =
+  -r{toxinidir}/test-requirements.txt
+  -r{toxinidir}/requirements.txt
+commands = stestr run --slowest {posargs}
 
 [testenv:pep8]
 commands = flake8 {posargs}
 
+[testenv:cover]
+setenv =
+  {[testenv]setenv}
+  PYTHON=coverage run --source coriolis --parallel-mode
+commands =
+  stestr run --no-subunit-trace {posargs}
+  coverage combine
+  coverage report --fail-under=82 --skip-covered
+  coverage html -d cover
+  coverage xml -o cover/coverage.xml
+
 [testenv:venv]
 commands = {posargs}
 
-[testenv:cover]
-commands = python setup.py test --coverage --testr-args='{posargs}'
-
 [flake8]
-# E123, E125 skipped as they are invalid PEP-8.
+# E125 is deliberately excluded. See https://github.com/jcrocholl/pep8/issues/126
+# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
 
-show-source = True
-ignore = E123,E125
-builtins = _
-exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
+ignore = E125,E251,W503,W504,E305,E731,E117,W605,F632
+exclude =  .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools