Skip to content

Commit

Permalink
[tests] use pytest for doctest
Browse files Browse the repository at this point in the history
- nosetest is not maintained any longer and fails with Python 3.10+.
  Use pytest instead for doctest.
- require pytest 7.0.1 or higher
- remove pytest filterwarnings because it was dropped in pytest 6.1.

Bug: T319164
Change-Id: I8e5d65c6784070c8a0376386dd45993fd245c207
  • Loading branch information
xqt committed Oct 3, 2022
1 parent 2b26efa commit 3b392ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a PIP 6+ requirements file for development dependencies
#

pytest >= 5.3
pytest >= 7.0.1
pytest-cov >= 3.0.0; python_version>="3.10"
pytest-cov >= 2.11.1; python_version<"3.10"
pytest-timeout
Expand Down
16 changes: 9 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ envlist =
hacking-py37

[params]
doctest_skip = --ignore-files=(gui|memento)\.py
# gui needs tkinter
doctest_skip =
--ignore-glob="*gui.py"
--ignore-glob="*memento.py"
exclude = --exclude make_dist.py,.tox,.git,./*.egg,build,./scripts/i18n/*
generate_user_files = -W error::UserWarning -m pwb generate_user_files -family:wikipedia -lang:test -v

Expand Down Expand Up @@ -41,7 +44,7 @@ deps =
flake8: .[flake8]
hacking: .[hacking]

fasttest: pytest >= 5.3
fasttest: pytest >= 7.0.1
fasttest: pytest-attrib>=0.1.3
fasttest: pytest-subtests >= 0.3.2
fasttest: mock
Expand All @@ -65,10 +68,10 @@ commands = commit-message-validator
basepython = python3
commands =
python {[params]generate_user_files}
nosetests --version
nosetests -v --with-doctest pywikibot {[params]doctest_skip}
pytest --version
pytest pywikibot --doctest-modules {[params]doctest_skip}
deps =
nose
pytest >= 7.0.1
.[eventstreams]
.[mwparserfromhell]
.[mysql]
Expand Down Expand Up @@ -232,8 +235,7 @@ exclude = .tox,.git,./*.egg,build,./scripts/i18n/*
ignore = D105,D211

[pytest]
minversion = 5.3
minversion = 7.0.1
testpaths = tests
python_files = *_tests.py
addopts = --ignore=tests/l10n_tests.py
filterwarnings = ignore::pytest.PytestDeprecationWarning

0 comments on commit 3b392ab

Please sign in to comment.