-
Notifications
You must be signed in to change notification settings - Fork 97
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
improve pytest configuration #1700
Conversation
testpaths = | ||
tests |
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 is more of a QoL improvement. with this one can type pytest
without specifying anything else to run these tests. LMK if you want me to revert this.
# enable all warnings | ||
-Wd |
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 personally would go a step further
# enable all warnings | |
-Wd | |
# turn warnings into errors | |
-We |
Right now there aren't any warnings so this is a good time to adopt such a change. With this option set, we get an early heads-up if something is about the change in the future.
I also added the |
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.
These look good to me. Not sure if we want one more approval on this. Maybe from @iameskild or @viniciusdc ?
This has been open for a while. I approved it and didn't hear any negative feedback so I went ahead and merged. |
Team agrees this is a useful commit to have warnings as errors. |
pytest
's default configuration is horrible with respect to a few aspects:--tb
): default is"long"
which not only shows a few lines above and below the one the error happened for each frame, but also the docstring for every stack. This easily buries the information I need in a lot of noise."short"
is better, but still pretty noisy."native"
is what Python gives you by default, which already includes a lot of information.-rX
/xfail_strict = True
): By default, the@pytest.mark.xfail
is not strict. This means whether the test fails or not,pytest
will never return a non-zero exit code. Since most people just look for a boolean signal from CI this can easily hide errors. With thexfail_strict = True
setting, unexpectedly passing tests cause the run to fail.-Wd
):pytest
follows Pythons convention and adopts the same warning filters. This means for example thatDeprecationWarning
's are not shown. However that is very useful information for developers. Setting-Wd
disables the filter and thus all warnings are shown.This PR adapts the
pytest.ini
configuration file to have more sensible "defaults".cc @kcpevey since we touched on this offline before.