-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add strict configuration option to enable all other strictness options
#13839
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
base: main
Are you sure you want to change the base?
Conversation
This is to make it consistent with the other `strict_` options. For pytest-dev#13823.
We want to have ini versions of all strictness flags, since they're usually more sensible as project configuration, and as preparation for adding the `strict` ini option. Refs pytest-dev#13823.
I figure the misspelling error is better than the "not found in `markers`" error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! Left some minor comments.
doc/en/reference/reference.rst
Outdated
|
|
||
| .. note:: | ||
| If new strictness options are added to pytest in the future, they will also be enabled by ``strict``. | ||
| We therefore only recommend using this option when using a locked version of pytest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| We therefore only recommend using this option when using a locked version of pytest. | |
| We therefore only recommend using this option when using a locked version of pytest or if you want to proactively adopt new strictness options as they are added. |
| current_overrides = getattr(namespace, "override_ini", None) | ||
| if current_overrides is None: | ||
| current_overrides = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplifed:
| current_overrides = getattr(namespace, "override_ini", None) | |
| if current_overrides is None: | |
| current_overrides = [] | |
| current_overrides = getattr(namespace, "override_ini", []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's written this way because namespace.override_ini can be set to None. I think it starts as None.
| if self._config.hasini("strict_markers"): | ||
| strict_markers = self._config.getini("strict_markers") | ||
| else: | ||
| strict_markers = self._config.getini("strict") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While simple, this pattern repeats, how about a simple convenience method?
| if self._config.hasini("strict_markers"): | |
| strict_markers = self._config.getini("strict_markers") | |
| else: | |
| strict_markers = self._config.getini("strict") | |
| strict_markers = self._config.getini_or("strict_markers", "strict") |
Not married to the name getini_or, other suggestions:
getini_fallbackgetini_or_else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll comment about this in the issue.
The `--strict` option is undeprecated and enables `strict`. Fix pytest-dev#13823.
This adds the
strictoption, as discussed in #13823.There are some prerequisites required to make everything consistent, as mentioned in the issue. Please see the commits for details.
Fixes #13823.
Fixes #7503.