-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Make --strict imply --strict-config / xfail_strict? #7503
Comments
I think it's a good idea to have some |
The only thing I want to add is that I'd probably expect it to also be a config value rather than just a CLI option. |
I like the idea of Whether we still need it with the warnings system or not, I think we should keep it until pytest 7 rather than scrambling to make such a large change now. |
I really like the idea of using IMHO we can discuss whether we need to wait until version 7 or can include it in some minor version of pytest 6. |
Should we consider giving the user the option?
Im just wondering if we add future 'strictness' but have then coupled the user into all or none situations. |
@symonk We already have |
Totally agree with @The-Compiler. In fact, |
No objections from me at all. |
I opened a PR: #7529 |
Can we flip the default here so markers default to strict in v6? What about xfail_strict |
We already have a warning for that since 4.5.0, so it should be quite clear what's going on even without
That one is much more controversial and I'm not sure if starting the discussion again will produce a different outcome. See #1299 and #814. |
From @nicoddemus seems like this is exactly that future release |
I think if we add strict-markers and strict-config to |
While I love |
Having |
In that case I think we should just drop the |
Indeed I believe this is the safest option: the breaking change in 6.0 then becomes the fact that As for if it should also cover |
Could also introduce |
Can we remove |
I don't see much value in it being a command-line value, TBH. To me it feels like a test-suite wide configuration rather something you want to switch on/off in the command-line.
Hmm good point! Indeed we just discouraged it in the docs. To follow proper protocols we should:
Note the same applies to changing the meaning of
I believe the latter causes less friction. Thoughts? |
Okay, so I suppose let's only deprecate I'd be glad if someone else could take over here though, as I should take care of some other things at the moment. |
Time for a plugin: pytest-strictest to introduce "--strictest" as a command flag that enables all 3 strict options |
fwiw I like the |
I think so yes. Created #7530 for that. Thanks everyone for participating in the discussion. I've moved this issue to the 7.0 milestone. |
I suppose this could be closed as a duplicate of #7233 then? |
Good point, but I think we should rather close #7233 and keep this one open, as I believe this discussion is more through and brought more ideas on how to move things forward. 👍 |
what about passing a pypi major version to strict: Then people can pass |
then you can keep |
I'm not sure what problem that would solve. Major releases come with some breakage, so projects likely need to adapt a little anyways - I don't see an issue with making |
Usually new strict options get added in minor releases because they're not a breaking change. If we made |
Having new strict flags trigger warnings until the next major release seems like a good idea anyway Having strict simply error on all from the last major release and warn on the new ones seems like a nice plan to me |
I don't follow. The whole point of the strict flags (at least the ones we have so far) is to turn warnings into errors? |
You're saying Pytest 7 should just enable strict-config and strict-markers by default? |
I'm not sure where you see me saying that. I'm saying |
My usecase/workflow is that I want to opt into all breaking warnings and exceptions and strictness settings and then dependabot will make a new PR where I manually disable any errors I can't fix immediately |
For the unlikely situation that |
With pytest 4.5.0 (May 2019), we introduced
--strict-markers
as a replacement for--strict
, and said:With #7286, now we also have
--strict-config
. Yet,--strict
is still an alias for--strict-markers
.Given that pytest 6 is allowed to do breaking changes, wouldn't it make sense for
--strict
to imply both--strict-markers
and--strict-config
now?(Though, on a second thought: Do we actually need
--strict-markers
in pytest 6 still, given the warning system? Probably still useful as a convenient way to turn those warnings into errors?)This would also make pytest more in line with other tools with a
--strict
flag - mypy and tsc (the typescript compiler) come to mind, where--strict
implies various different strict flags.cc @gnikonorov (who added
--strict-config
), @webknjaz and @DahlitzFlorian (some existing discussion in #7233), and @nicoddemus (#5023) - what do you think?The text was updated successfully, but these errors were encountered: