8000 MAINT: Ignore pytest's PytestConfigWarning by WarrenWeckesser · Pull Request #12913 · scipy/scipy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Ignore pytest's PytestConfigWarning #12913

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

Merged
merged 1 commit into from
Oct 4, 2020

Conversation

WarrenWeckesser
Copy link
Member
@WarrenWeckesser WarrenWeckesser commented Oct 3, 2020

When pytest is run with python optimization set by the environment variable
PYTHONOPTIMIZE=2, it generates the warning

pytest.PytestConfigWarning: assertions not in test modules or plugins
will be ignored because assert statements are not executed by the
underlying Python interpreter (are you using python -O?)

Apparently this warning causes the test suite to fail. In this change,
I've added

ignore:assertions not in test modules or plugins:pytest.PytestConfigWarning

to the filter warnings used by pytest, so the PytestConfigWarning is
ignored.

@WarrenWeckesser WarrenWeckesser added the CI Items related to the CI tools such as CircleCI, GitHub Actions or Azure label Oct 3, 2020
@WarrenWeckesser
Copy link
Member Author

I expect we'll see some failures in the same Travis CI run that had been failing because of the PytestConfigWarning. Locally, when I run the stats tests with PYTHONOPTIMIZE=2 set, I get these failures:

==================================================================== short test summary info =====================================================================
FAILED ../../tests/test_continuous_basic.py::test_cont_basic[geninvgauss-arg33] - RuntimeWarning: parsing methods must have __doc__ for pycparser to work properly
FAILED ../../tests/test_continuous_basic.py::test_methods_with_lists[geninvgauss-args33-cdf] - RuntimeWarning: parsing methods must have __doc__ for pycparser ...
FAILED ../../tests/test_continuous_basic.py::test_methods_with_lists[geninvgauss-args33-logcdf] - RuntimeWarning: parsing methods must have __doc__ for pycpars...
FAILED ../../tests/test_continuous_basic.py::test_methods_with_lists[geninvgauss-args33-sf] - RuntimeWarning: parsing methods must have __doc__ for pycparser t...
FAILED ../../tests/test_continuous_basic.py::test_methods_with_lists[geninvgauss-args33-logsf] - RuntimeWarning: parsing methods must have __doc__ for pycparse...
FAILED ../../tests/test_continuous_basic.py::test_methods_with_lists[geninvgauss-args33-ppf] - RuntimeWarning: parsing methods must have __doc__ for pycparser ...
FAILED ../../tests/test_continuous_basic.py::test_methods_with_lists[geninvgauss-args33-isf] - RuntimeWarning: parsing methods must have __doc__ for pycparser ...
FAILED ../../tests/test_distributions.py::TestGenInvGauss::test_invgauss - RuntimeWarning: parsing methods must have __doc__ for pycparser to work properly
============================================ 8 failed, 3820 passed, 689 skipped, 264 deselected, 2 xfailed in 50.44s =============================================

When pytest is run with python optimization set by the environment variable
PYTHONOPTIMIZE=2, it generates the warning

    pytest.PytestConfigWarning: assertions not in test modules or plugins
    will be ignored because assert statements are not executed by the
    underlying Python interpreter (are you using python -O?)

Apparently this warning causes the test suite to fail.  In this change,
I've added

    ignore:assertions not in test modules or plugins:pytest.PytestConfigWarning

to the filter warnings used by pytest, so the PytestConfigWarning is
ignored.
@WarrenWeckesser
Copy link
Member Author

I expect we'll see some failures in the same Travis CI run...

It turns out all the tests on Travis CI now pass, so I guess there is some other difference between the Travis CI environment and my local setup. Given that, I think we can consider merging this change to get all the CI tests back to passing.

@peterbell10
Copy link
Member

CI's green again, so lets get it in. Thanks @WarrenWeckesser.

@peterbell10 peterbell10 merged commit 02563b2 into scipy:master Oct 4, 2020
@peterbell10 peterbell10 added the backport-candidate This fix should be ported by a maintainer to previous SciPy versions. label Oct 4, 2020
@peterbell10 peterbell10 added this to the 1.6.0 milestone Oct 4, 2020
@peterbell10
Copy link
Member

Marked as backport candidate as I assume maintenance branches will get the same failures.

@WarrenWeckesser WarrenWeckesser deleted the pytest-ignore-warning branch October 4, 2020 11:35
@tylerjereddy tylerjereddy modified the milestones: 1.6.0, 1.5.3 Oct 8, 2020
@tylerjereddy tylerjereddy removed the backport-candidate This fix should be ported by a maintainer to previous SciPy versions. label Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Items related to the CI tools such as CircleCI, GitHub Actions or Azure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0