Skip to content

Fail tests with uncaught warnings #102

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

Closed
ricardoV94 opened this issue Dec 18, 2022 · 4 comments · Fixed by #133
Closed

Fail tests with uncaught warnings #102

ricardoV94 opened this issue Dec 18, 2022 · 4 comments · Fixed by #133
Labels
good first issue Good for newcomers

Comments

@ricardoV94
Copy link
Member

The earlier we start, the easier it is :)

@ricardoV94 ricardoV94 added the good first issue Good for newcomers label Dec 18, 2022
@michaelraczycki
Copy link
Collaborator

do you mean to change the pytest settings to strict? Because I believe that by default pytest should fail test if it has uncaught exception

@ricardoV94
Copy link
Member Author

Oh I mean uncaught warnings

@ricardoV94 ricardoV94 changed the title Fail tests with uncaught exceptions Fail tests with uncaught warnings Mar 5, 2023
@michaelraczycki
Copy link
Collaborator

I'd like to do it then, do you have something specific in mind? I'd just create the pytest.ini file and use "addopts = -W error" global setting, then all warnings should fail the test. Later on we can exclude specific types of warnings if need be

@ricardoV94
Copy link
Member Author

ricardoV94 commented Mar 5, 2023

According to pytest you can specify

[pytest]
filterwarnings =
    error

https://docs.pytest.org/en/7.1.x/how-to/capture-warnings.html

Yes that should be a good start. Feel free to open a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants