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

test: use stricter pytest config #2327

Merged
merged 1 commit into from
Sep 21, 2023
Merged

test: use stricter pytest config #2327

merged 1 commit into from
Sep 21, 2023

Conversation

sobolevn
Copy link
Member

Looking at #2325 I've noticed that noww is not a registered marker. Later, I've noticed that pytest does not check any existing markers or any existing configuration options. I propose to fix that.

See:

Unregistered marks applied with the @pytest.mark.name_of_the_mark decorator will always emit a warning in order to avoid silently doing something surprising due to mistyped names. As described in the previous section, you can disable the warning for custom marks by registering them in your pytest.ini file or using a custom pytest_configure hook.

When the --strict-markers command-line flag is passed, any unknown marks applied with the @pytest.mark.name_of_the_mark decorator will trigger an error. You can enforce this validation in your project by adding --strict-markers to addopts:

Here: https://docs.pytest.org/en/latest/how-to/mark.html#raising-errors-on-unknown-marks

--strict-config       any warnings encountered while parsing the `pytest`
                        section of the configuration file raise errors.

Here: https://docs.pytest.org/en/7.1.x/reference/reference.html

@sobolevn sobolevn requested review from a team as code owners September 21, 2023 07:41
@sonarcloud
Copy link

sonarcloud bot commented Sep 21, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@github-actions
Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/2327

@sobolevn sobolevn merged commit 7adc074 into main Sep 21, 2023
18 checks passed
@sobolevn sobolevn deleted the stricter-pytest-config branch September 21, 2023 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants