Skip to content

Commit

Permalink
[test] move doctest_skip to pytest command
Browse files Browse the repository at this point in the history
Tox v4 does not concatenate multiple lines when doing variable
substitution from another section hence the config:

  [params]
  doctest_skip =
   --ignore-glob="*gui.py"
   --ignore-glob="*memento.py"

When used in a commands with `pytest {[params]doctest_skip}` results in
tox 4 generating the commands:

1) pytest '--ignore-glob="*gui.py"'
2) '--ignore-glob="*memento.py"'

The `doctest_skip` variable uses multiple lines since 3b392ab. The
parameter substitution comes from 2014 commit c55ea2f which
introduced `nose_skip` (later renamed `doctest_skip`).

Since the `doctest_skip` parameter is only substitued once, move it to
the pytest doctest command.

With tox 3 (I have added new lines to the lists):

  $ tox -e doctest --showconf
  ...
  [testenv:doctest]
  commands = [
    ['python', '-W', 'error::UserWarning', '-m', 'pwb',
    'generate_user_files', '-family:wikipedia', '-lang:test', '-v'],
    ['pytest', '--version'],
    ['pytest', 'pywikibot', '--doctest-modules',
     '--ignore-glob=*gui.py', '--ignore-glob=*memento.py']
  ]

With tox 4:

  $ tox config -e doctest -k commands
  [testenv:doctest]
  commands =
    python -W error::UserWarning -m pwb generate_user_files -family:wikipedia -lang:test -v
    pytest --version
    pytest pywikibot --doctest-modules '--ignore-glob=*gui.py' '--ignore-glob=*memento.py'

Bug: T345695
Change-Id: Ic92e1ae2996e734431706242ffbc86dd7f6ff633
  • Loading branch information
hashar committed Sep 22, 2023
1 parent 0b67156 commit 32742a2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ envlist =
hacking-{py36,py39}

[params]
# gui needs tkinter
doctest_skip =
--ignore-glob="*gui.py"
--ignore-glob="*memento.py"
# Note: tox 4 does not support multiple lines when doing parameters
# substitution.
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 @@ -73,7 +71,10 @@ basepython = python3
commands =
python {[params]generate_user_files}
pytest --version
pytest pywikibot --doctest-modules {[params]doctest_skip}
# gui.py needs tkinter
# memento.py has too many timeout
pytest pywikibot --doctest-modules --ignore-glob="*gui.py" --ignore-glob="*memento.py"

deps =
pytest >= 7.0.1
.[eventstreams]
Expand Down

0 comments on commit 32742a2

Please sign in to comment.