Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def pytest_addoption(parser):
action="store", type=int, dest="maxfail", default=0,
help="exit after first num failures or errors.")
group._addoption('--strict', action="store_true",
help="run pytest in strict mode, warnings become errors.")
help="marks not registered in configuration file raise errors.")
group._addoption("-c", metavar="file", type=str, dest="inifilename",
help="load configuration from `file` instead of trying to locate one of the implicit configuration files.")
group._addoption("--continue-on-collection-errors", action="store_true",
Expand Down
1 change: 1 addition & 0 deletions changelog/2444.trivial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update help message for ``--strict`` to make it clear it only deals with unregistered markers, not warnings.
9 changes: 4 additions & 5 deletions doc/en/example/markers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,12 @@ For an example on how to add and work with markers from a plugin, see

It is recommended to explicitly register markers so that:

* there is one place in your test suite defining your markers
* There is one place in your test suite defining your markers

* asking for existing markers via ``pytest --markers`` gives good output
* Asking for existing markers via ``pytest --markers`` gives good output

* typos in function markers are treated as an error if you use
the ``--strict`` option. Future versions of ``pytest`` are probably
going to start treating non-registered markers as errors at some point.
* Typos in function markers are treated as an error if you use
the ``--strict`` option.

.. _`scoped-marking`:

Expand Down
2 changes: 1 addition & 1 deletion testing/test_skipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def test_strict_and_skip(self, testdir):
def test_hello():
pass
""")
result = testdir.runpytest("-rs --strict")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed --strict from this test just because --strict doesn't really have anything to do with it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just stumbled upon this test while working on #8384. It seems to me that with this change, the test (test_strict_and_skip) doesn't test what it intended to test, and it seems equal to test_skip_no_reason now.

Looking at 1fbd19b, the intention of the test was to check whether the skip marker is correctly registered by pytest, so I think this should be readded as --strict-markers, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

If you are working on #8384, would you mind doing that in the same PR?

result = testdir.runpytest("-rs")
result.stdout.fnmatch_lines([
"*unconditional skip*",
"*1 skipped*",
Expand Down