Skip to content

Commit

Permalink
Migrate from nosetest to pytest
Browse files Browse the repository at this point in the history
nosetest doesn't support python 3.10 and over the years the python
community has been settling on pytest as test runner, this change
introduces pytest and adds py3.10 to the gh workflow testing matrix.
  • Loading branch information
freyes committed Oct 25, 2022
1 parent 49ba14c commit 7b65b73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v1
Expand All @@ -19,6 +19,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install -q --yes libxml2-dev libxslt1-dev
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Lint with tox
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ flake8-per-file-ignores
pydocstyle<4.0.0
coverage<6.0.0 # coverage 6.0+ drops support for py3.5/py2.7
mock>=1.2
nose>=1.3.7
pytest
pytest-cov
pbr>=1.8.0,<1.9.0
simplejson>=2.2.0
netifaces>=0.10.4
Expand Down
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ setenv = VIRTUAL_ENV={envdir}
install_command =
{toxinidir}/pip.sh install {opts} {packages}

commands = nosetests --with-coverage --cover-package=zaza.openstack {posargs} {toxinidir}/unit_tests
commands = pytest --cov=zaza.openstack {posargs} {toxinidir}/unit_tests

[testenv:py3]
basepython = python3
Expand All @@ -38,6 +38,10 @@ deps = -r{toxinidir}/requirements.txt
basepython = python3.9
deps = -r{toxinidir}/requirements.txt

[testenv:py3.10]
basepython = python3.10
deps = -r{toxinidir}/requirements.txt

[testenv:pep8]
basepython = python3
deps = -r{toxinidir}/requirements.txt
Expand Down

0 comments on commit 7b65b73

Please sign in to comment.