Skip to content

Commit

Permalink
Disambiguate -ra / -r=a
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jun 22, 2019
1 parent 17f9a46 commit f93039c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog/1149.feature.rst
@@ -1,4 +1,5 @@
Pytest no longer accepts prefixes of command-line arguments.
This was previously allowed where the ``ArgumentParser`` thought it was unambigious,
because this could be incorrect due to delayed parsing of options for plugins.
Concretely, you may need to change e.g. ``-ra`` to ``-r=a``.
See for example issues #1149, #3413, and #4009.
4 changes: 2 additions & 2 deletions doc/en/customize.rst
Expand Up @@ -136,7 +136,7 @@ progress output, you can write it into a configuration file:
# content of pytest.ini or tox.ini
# setup.cfg files should use [tool:pytest] section instead
[pytest]
addopts = -ra -q
addopts = -r=a -q
Alternatively, you can set a ``PYTEST_ADDOPTS`` environment variable to add command
line options while the environment is in use:
Expand All @@ -161,7 +161,7 @@ The actual command line executed is:

.. code-block:: bash
pytest -ra -q -v -m slow
pytest -r=a -q -v -m slow
Note that as usual for other command-line applications, in case of conflicting options the last one wins, so the example
above will show verbose output because ``-v`` overwrites ``-q``.
Expand Down
2 changes: 1 addition & 1 deletion doc/en/usage.rst
Expand Up @@ -200,7 +200,7 @@ Example:
.. code-block:: pytest
$ pytest -ra
$ pytest -r=a
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
cachedir: $PYTHON_PREFIX/.pytest_cache
Expand Down
2 changes: 1 addition & 1 deletion testing/test_runner.py
Expand Up @@ -758,7 +758,7 @@ def test_foo():
pass
"""
)
result = testdir.runpytest("-ra")
result = testdir.runpytest("-r=a")
result.stdout.fnmatch_lines(["*just because*"])
result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"])

Expand Down
6 changes: 3 additions & 3 deletions testing/test_skipping.py
Expand Up @@ -828,7 +828,7 @@ def test_5(fail):
pass
"""
)
result = testdir.runpytest("-ra")
result = testdir.runpytest("-r=a")
result.stdout.fnmatch_lines(
[
"SKIP*four*",
Expand All @@ -851,7 +851,7 @@ def test_foo():
pass
""",
)
result = testdir.runpytest("-ra")
result = testdir.runpytest("-r=a")
result.stdout.fnmatch_lines(["ERROR*test_foo*"])


Expand Down Expand Up @@ -1145,7 +1145,7 @@ def test_fail():
assert 0
"""
)
result = testdir.runpytest("-ra")
result = testdir.runpytest("-r=a")
result.stdout.fnmatch_lines(
[
"=* FAILURES *=",
Expand Down
4 changes: 2 additions & 2 deletions testing/test_terminal.py
Expand Up @@ -1203,7 +1203,7 @@ def test_failure():
assert 0
"""
)
result = testdir.runpytest("-ra")
result = testdir.runpytest("-r=a")
result.stdout.fnmatch_lines(
[
"*= warnings summary =*",
Expand All @@ -1230,7 +1230,7 @@ def test_failure():
assert 0
"""
)
result = testdir.runpytest("-ra")
result = testdir.runpytest("-r=a")
result.stdout.fnmatch_lines(
[
"*= warnings summary =*",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -121,7 +121,7 @@ commands = python scripts/release.py {posargs}

[pytest]
minversion = 2.0
addopts = -ra -p pytester --strict-markers
addopts = -r=a -p pytester --strict-markers
rsyncdirs = tox.ini doc src testing
python_files = test_*.py *_test.py testing/*/*.py
python_classes = Test Acceptance
Expand Down

0 comments on commit f93039c

Please sign in to comment.