Skip to content

Disable pytest-warnings during testing - #6163

Merged
astrofrog merged 1 commit into
astropy:masterfrom
bsipocz:pytest_disable_warning
Jun 7, 2017
Merged

astrofrog merged 1 commit into
astropy:masterfrom
bsipocz:pytest_disable_warning

Conversation

@bsipocz

@bsipocz bsipocz commented Jun 6, 2017 •

Copy link
Copy Markdown
Member

pytest 3.1.0 included pytest-warnings in its core [0] and now lists all warning that occurred during testing at the end of the build, which is way too verbose. This PR sets it back to previous behaviour.

Obviously, long term we can aim to write tests that don't emit warnings...

[0] https://docs.pytest.org/en/latest/changelog.html#changelog-history

@pllim

pllim commented Jun 6, 2017

Copy link
Copy Markdown
Member

Just curious: Does this also silence the [tool:pytest] warning?

@bsipocz

bsipocz commented Jun 6, 2017

Copy link
Copy Markdown
Member Author

No, I don't think so as that is raised by pytest itself, while this silencing is done for warnings that are raised during the tests (similar to the sphinx warnings, the build doesn't fail there for any random warnings, just the ones that are generated by sphinx).

@saimn

saimn commented Jun 6, 2017

Copy link
Copy Markdown
Contributor

Currently this makes the output of pytest very difficult to read, so 👍
Obviously some work is needed to close files in the fits tests: 😀

❯ python setup.py test -t astropy/io/fits/tests/ | grep ResourceWarning | wc -l
79

@astrofrog

Copy link
Copy Markdown
Member

I'm surprised the open files aren't caught by the tests with the --open-files flag on Travis

@astrofrog
astrofrog merged commit 97d16a3 into astropy:master Jun 7, 2017
@saimn

saimn commented Jun 7, 2017

Copy link
Copy Markdown
Contributor

@astrofrog - No idea, how is it supposed to work ? Locally it doesn't work, many fits tests are not closing files (and even if I try with another simple txt file).

@pllim

pllim commented Jun 7, 2017

Copy link
Copy Markdown
Member

many fits tests are not closing files

Is this because of the memmap thingy?

@saimn

saimn commented Jun 7, 2017

Copy link
Copy Markdown
Contributor

@pllim - Not sure but I would say no, it's probably just an historic remnant.

@bsipocz

bsipocz commented Jun 7, 2017

Copy link
Copy Markdown
Member Author

@saimn - The worrying thing is as, @astrofrog mentioned above, that we're supposed to test for open files. An those tests say there are no open files remained, while in the same time there are all these warnings contradicting it. Even if we don't find the cause, this probably serious enough to get a separate issue.

@saimn

saimn commented Jun 7, 2017

Copy link
Copy Markdown
Contributor

@bsipocz - Agreed, and btw I'm trying to understand this also for #6082 (comment)

@bsipocz

bsipocz commented Jun 29, 2017

Copy link
Copy Markdown
Member Author

This seems to have no effect, at least I saw tons of warnings at the end of the test session when running the tests from a pip installed version, so ideally we need to come up with a solution that works in those cases, too.

bsipocz referenced this pull request in MacPython/astropy-wheels Jul 7, 2017
keflavich added a commit to keflavich/spectral-cube that referenced this pull request Sep 6, 2017
@bsipocz
bsipocz deleted the pytest_disable_warning branch September 16, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants