Skip to content

Commit f93039c

Browse files
committed
Disambiguate -ra / -r=a
1 parent 17f9a46 commit f93039c

File tree

7 files changed

+11
-10
lines changed

7 files changed

+11
-10
lines changed

changelog/1149.feature.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Pytest no longer accepts prefixes of command-line arguments.
22
This was previously allowed where the ``ArgumentParser`` thought it was unambigious,
33
because this could be incorrect due to delayed parsing of options for plugins.
4+
Concretely, you may need to change e.g. ``-ra`` to ``-r=a``.
45
See for example issues #1149, #3413, and #4009.

doc/en/customize.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ progress output, you can write it into a configuration file:
136136
# content of pytest.ini or tox.ini
137137
# setup.cfg files should use [tool:pytest] section instead
138138
[pytest]
139-
addopts = -ra -q
139+
addopts = -r=a -q
140140
141141
Alternatively, you can set a ``PYTEST_ADDOPTS`` environment variable to add command
142142
line options while the environment is in use:
@@ -161,7 +161,7 @@ The actual command line executed is:
161161

162162
.. code-block:: bash
163163
164-
pytest -ra -q -v -m slow
164+
pytest -r=a -q -v -m slow
165165
166166
Note that as usual for other command-line applications, in case of conflicting options the last one wins, so the example
167167
above will show verbose output because ``-v`` overwrites ``-q``.

doc/en/usage.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ Example:
200200
201201
.. code-block:: pytest
202202
203-
$ pytest -ra
203+
$ pytest -r=a
204204
=========================== test session starts ============================
205205
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
206206
cachedir: $PYTHON_PREFIX/.pytest_cache

testing/test_runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ def test_foo():
758758
pass
759759
"""
760760
)
761-
result = testdir.runpytest("-ra")
761+
result = testdir.runpytest("-r=a")
762762
result.stdout.fnmatch_lines(["*just because*"])
763763
result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"])
764764

testing/test_skipping.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ def test_5(fail):
828828
pass
829829
"""
830830
)
831-
result = testdir.runpytest("-ra")
831+
result = testdir.runpytest("-r=a")
832832
result.stdout.fnmatch_lines(
833833
[
834834
"SKIP*four*",
@@ -851,7 +851,7 @@ def test_foo():
851851
pass
852852
""",
853853
)
854-
result = testdir.runpytest("-ra")
854+
result = testdir.runpytest("-r=a")
855855
result.stdout.fnmatch_lines(["ERROR*test_foo*"])
856856

857857

@@ -1145,7 +1145,7 @@ def test_fail():
11451145
assert 0
11461146
"""
11471147
)
1148-
result = testdir.runpytest("-ra")
1148+
result = testdir.runpytest("-r=a")
11491149
result.stdout.fnmatch_lines(
11501150
[
11511151
"=* FAILURES *=",

testing/test_terminal.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ def test_failure():
12031203
assert 0
12041204
"""
12051205
)
1206-
result = testdir.runpytest("-ra")
1206+
result = testdir.runpytest("-r=a")
12071207
result.stdout.fnmatch_lines(
12081208
[
12091209
"*= warnings summary =*",
@@ -1230,7 +1230,7 @@ def test_failure():
12301230
assert 0
12311231
"""
12321232
)
1233-
result = testdir.runpytest("-ra")
1233+
result = testdir.runpytest("-r=a")
12341234
result.stdout.fnmatch_lines(
12351235
[
12361236
"*= warnings summary =*",

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ commands = python scripts/release.py {posargs}
121121

122122
[pytest]
123123
minversion = 2.0
124-
addopts = -ra -p pytester --strict-markers
124+
addopts = -r=a -p pytester --strict-markers
125125
rsyncdirs = tox.ini doc src testing
126126
python_files = test_*.py *_test.py testing/*/*.py
127127
python_classes = Test Acceptance

0 commit comments

Comments
 (0)