Skip to content

Commit 503ef3b

Browse files
committed
Switch from nosetests to pytest
1 parent 7ada53d commit 503ef3b

File tree

6 files changed

+36
-28
lines changed

6 files changed

+36
-28
lines changed

.coveragerc

+13
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
[run]
22
branch = False
3+
source =
4+
deform
5+
tests
6+
7+
[paths]
8+
source =
9+
deform
10+
*/deform
11+
*/site-packages/deform
12+
13+
[report]
14+
show_missing = true
15+
precision = 2

.github/workflows/ci-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030
include:
3131
# Only run coverage on ubuntu-latest, except on pypy3
3232
- os: "ubuntu-latest"
33-
nosetests-args: "--with-xunit"
33+
pytest-args: "--with-xunit"
3434
- os: "ubuntu-latest"
3535
py: "pypy3"
36-
nosetests-args: ""
36+
pytest-args: ""
3737
exclude:
3838
# Linux and macOS don't have x86 python
3939
- os: "ubuntu-latest"
@@ -54,7 +54,7 @@ jobs:
5454
architecture: ${{ matrix.architecture }}
5555
- run: pip install tox
5656
- name: Running tox
57-
run: tox -e py -- ${{ matrix.nosetests-args }}
57+
run: tox -e py -- ${{ matrix.pytest-args }}
5858
functional3:
5959
runs-on: ubuntu-latest
6060
name: Functional web tests

run-selenium-tests.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ SERVER_PID=$!
5050
trap cleanup EXIT
5151

5252
# Run functional test suite against test server
53-
nosetests "$@"
53+
pytest "$@"
5454

5555
exit 0

setup.cfg

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
[easy_install]
22
zip_ok = false
33

4-
[nosetests]
5-
match=^test
6-
where=deform
7-
nocapture=1
8-
cover-package=deform
9-
cover-erase=1
10-
exclude=test_demo
4+
[tool:pytest]
5+
python_files = test_*.py
6+
testpaths =
7+
deform/tests
8+
addopts = -W always
119

1210
[aliases]
1311
dev = develop easy_install deform[testing]

setup.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ def readfile(name):
4444
"readme_renderer",
4545
]
4646

47-
testing_extras = ["beautifulsoup4", "coverage", "flaky", "nose", "pyramid"]
47+
testing_extras = [
48+
"beautifulsoup4",
49+
"coverage",
50+
"flaky",
51+
"pyramid",
52+
"pytest",
53+
"pytest-cov",
54+
]
4855

4956
# Needed to run deformdemo tests
5057
functional_testing_extras = [

tox.ini

+6-16
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,12 @@ setenv =
1212
COVERAGE_FILE=.coverage.{envname}
1313
commands =
1414
python --version
15-
nosetests --with-xunit --xunit-file=nosetests-{envname}.xml {posargs:}
16-
17-
# we separate coverage into its own testenv because a) "last run wins" wrt
18-
# cobertura jenkins reporting and b) pypy and jython can't handle any
19-
# combination of versions of coverage and nosexcover that i can find.
20-
[py-cover]
21-
commands =
22-
pip install deform[testing]
23-
coverage run --source=deform --omit=deform/[a-z]*_[a-z0-9]*.py {envbindir}/nosetests
24-
coverage xml -o {envname}.xml -i
15+
pytest {posargs:}
2516

2617
[testenv:py39-cover]
2718
commands =
28-
{[py-cover]commands}
29-
setenv =
30-
COVERAGE_FILE=.coverage.py3
19+
python --version
20+
pytest --cov {posargs:}
3121

3222
[testenv:lint]
3323
commands =
@@ -40,10 +30,10 @@ extras =
4030
lint
4131

4232
[testenv:coverage]
33+
skip_install = true
4334
commands =
44-
coverage erase
4535
coverage combine
46-
coverage xml -i
36+
coverage xml
4737
coverage report --show-missing --fail-under=100
4838
deps =
4939
coverage
@@ -64,7 +54,7 @@ commands =
6454
passenv = DISPLAY WEBDRIVER FIREFOX_PATH TRAVIS URL WAITTOSTART CONTAINERTZ
6555
commands =
6656
pip install deform[testing,functional]
67-
./run-selenium-tests.bash --with-flaky --max-runs=4 {posargs}
57+
./run-selenium-tests.bash --max-runs=4 {posargs}
6858
deps =
6959
docker
7060

0 commit comments

Comments
 (0)