Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--strict option is not related to warnings at all #2444

Closed
nicoddemus opened this Issue May 29, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@nicoddemus
Copy link
Member

nicoddemus commented May 29, 2017

(venv) $ pytest --help
...
  --strict              run pytest in strict mode, warnings become errors
...

(venv) $ pytest --strict test_something.py 
========================== test session starts ==========================
platform darwin -- Python 3.6.1, pytest-3.1.0, py-1.4.33, pluggy-0.4.0
rootdir: /Users/okken/projects/book/bopytest/Book/code/foo, inifile:
collected 0 items 

=========================== warnings summary ============================
test_something.py::TestHelper
  cannot collect test class 'TestHelper' because it has a __init__ constructor

-- Docs: http://doc.pytest.org/en/latest/warnings.html
====================== 1 warnings in 0.01 seconds =======================
@RonnyPfannschmidt

This comment has been minimized.

Copy link
Member

RonnyPfannschmidt commented May 29, 2017

it seems to be used only and explicitly only in the mark module which doesnt issue warnings about unknown marks at the moment

so strict was never implemented correct

@The-Compiler

This comment has been minimized.

Copy link
Member

The-Compiler commented May 29, 2017

--strict was added before pytest had a concept of warnings really - I also remember there was a discussion about how it'd be bad for --strict to introduce more failures (a viewpoint I'm not sure I agree with, FWIW), because everyone is using it for marker warnings already anyways.

@RonnyPfannschmidt

This comment has been minimized.

Copy link
Member

RonnyPfannschmidt commented May 29, 2017

so we either start a rename process so its named for what it actually does or make it fail more things

@okken

This comment has been minimized.

Copy link
Contributor

okken commented May 30, 2017

If it never worked as described, I would recommend changing the help text to state that --strict turns on the requirement that markers have to be declared and remove the reference to warnings.

@nicoddemus

This comment has been minimized.

Copy link
Member Author

nicoddemus commented May 30, 2017

Definitely!

@nicoddemus nicoddemus changed the title --strict option doesn't appear to work --strict option is not related to warnings at all May 30, 2017

@nicoddemus

This comment has been minimized.

Copy link
Member Author

nicoddemus commented May 30, 2017

I propose we just update the help text related to --strict, and document more prominently how to turn warnings into errors: -W error.

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Jul 4, 2017

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Jul 4, 2018

Bug 1470530 - [wptrunner] Correct the warning to error option for pyt…
…est. r=ato

Currently the "--strict" option is used to turn warnings into
errors. But even the help content says that, it is not true.
Instead this option is only used for markers.

To actually turn warnings into errors the "-W error" option
would have to be used.

More details see:
pytest-dev/pytest#2444

MozReview-Commit-ID: AQMwZlwC46w

--HG--
extra : rebase_source : 9cc0cffa2d6b5f3082a9e6b93ec729a4601481fc

mcmanus pushed a commit to mcmanus/gecko that referenced this issue Jul 5, 2018

Bug 1470530 - [wptrunner] Correct the warning to error option for pyt…
…est. r=ato

Currently the "--strict" option is used to turn warnings into
errors. But even the help content says that, it is not true.
Instead this option is only used for markers.

To actually turn warnings into errors the "-W error" option
would have to be used.

More details see:
pytest-dev/pytest#2444

MozReview-Commit-ID: AQMwZlwC46w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.