Skip to content

Commit

Permalink
Switch from nosetests to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepiercy committed Nov 12, 2020
1 parent 7ada53d commit 503ef3b
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 28 deletions.
13 changes: 13 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
[run]
branch = False
source =
deform
tests

[paths]
source =
deform
*/deform
*/site-packages/deform

[report]
show_missing = true
precision = 2
6 changes: 3 additions & 3 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
include:
# Only run coverage on ubuntu-latest, except on pypy3
- os: "ubuntu-latest"
nosetests-args: "--with-xunit"
pytest-args: "--with-xunit"
- os: "ubuntu-latest"
py: "pypy3"
nosetests-args: ""
pytest-args: ""
exclude:
# Linux and macOS don't have x86 python
- os: "ubuntu-latest"
Expand All @@ -54,7 +54,7 @@ jobs:
architecture: ${{ matrix.architecture }}
- run: pip install tox
- name: Running tox
run: tox -e py -- ${{ matrix.nosetests-args }}
run: tox -e py -- ${{ matrix.pytest-args }}
functional3:
runs-on: ubuntu-latest
name: Functional web tests
Expand Down
2 changes: 1 addition & 1 deletion run-selenium-tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ SERVER_PID=$!
trap cleanup EXIT

# Run functional test suite against test server
nosetests "$@"
pytest "$@"

exit 0
12 changes: 5 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[easy_install]
zip_ok = false

[nosetests]
match=^test
where=deform
nocapture=1
cover-package=deform
cover-erase=1
exclude=test_demo
[tool:pytest]
python_files = test_*.py
testpaths =
deform/tests
addopts = -W always

[aliases]
dev = develop easy_install deform[testing]
Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ def readfile(name):
"readme_renderer",
]

testing_extras = ["beautifulsoup4", "coverage", "flaky", "nose", "pyramid"]
testing_extras = [
"beautifulsoup4",
"coverage",
"flaky",
"pyramid",
"pytest",
"pytest-cov",
]

# Needed to run deformdemo tests
functional_testing_extras = [
Expand Down
22 changes: 6 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,12 @@ setenv =
COVERAGE_FILE=.coverage.{envname}
commands =
python --version
nosetests --with-xunit --xunit-file=nosetests-{envname}.xml {posargs:}

# we separate coverage into its own testenv because a) "last run wins" wrt
# cobertura jenkins reporting and b) pypy and jython can't handle any
# combination of versions of coverage and nosexcover that i can find.
[py-cover]
commands =
pip install deform[testing]
coverage run --source=deform --omit=deform/[a-z]*_[a-z0-9]*.py {envbindir}/nosetests
coverage xml -o {envname}.xml -i
pytest {posargs:}

[testenv:py39-cover]
commands =
{[py-cover]commands}
setenv =
COVERAGE_FILE=.coverage.py3
python --version
pytest --cov {posargs:}

[testenv:lint]
commands =
Expand All @@ -40,10 +30,10 @@ extras =
lint

[testenv:coverage]
skip_install = true
commands =
coverage erase
coverage combine
coverage xml -i
coverage xml
coverage report --show-missing --fail-under=100
deps =
coverage
Expand All @@ -64,7 +54,7 @@ commands =
passenv = DISPLAY WEBDRIVER FIREFOX_PATH TRAVIS URL WAITTOSTART CONTAINERTZ
commands =
pip install deform[testing,functional]
./run-selenium-tests.bash --with-flaky --max-runs=4 {posargs}
./run-selenium-tests.bash --max-runs=4 {posargs}
deps =
docker

Expand Down

0 comments on commit 503ef3b

Please sign in to comment.