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

Get rid of ResourceWarning of pytest #551

Open
unkcpz opened this issue Jan 31, 2024 · 3 comments
Open

Get rid of ResourceWarning of pytest #551

unkcpz opened this issue Jan 31, 2024 · 3 comments
Labels
blocked This issue/PR is blocked by another issue/PR.

Comments

@unkcpz
Copy link
Member

unkcpz commented Jan 31, 2024

In #509, the warnings are shown as errors, and will popped up if run with pytest -s.

Here is one that we don't know how to get rid of:

Traceback (most recent call last):
  File "/home/jyu/micromamba/envs/aiidalab-dev/lib/python3.9/site-packages/_pytest/unraisableexception.py", line 59, in __exit__
    del self.unraisable
ResourceWarning: unclosed file <_io.BufferedReader name=6>
Exception ignored in: <_io.FileIO name=8 mode='rb' closefd=True>
Traceback (most recent call last):
  File "/home/jyu/micromamba/envs/aiidalab-dev/lib/python3.9/site-packages/_pytest/unraisableexception.py", line 59, in __exit__
    del self.unraisable
ResourceWarning: unclosed file <_io.BufferedReader name=8>

I did a close look and narrow it down to aiida.manage.tests.pytest_fixtures::aiida_profile. It must be someway to elegantly close the file when the test session closed.

@danielhollas
Copy link
Contributor

@unkcpz it might be good to open this issue in the aiida-core repo since that's where it should be fixed imo (or at least we should try to fix it there first). Thank for digging into this, this was an extremely frustrating issue when I was getting rid of all the other warnings.

@unkcpz
Copy link
Member Author

unkcpz commented Jan 31, 2024

Sure, I asked Sebastiaan in aiidateam/aiida-core#6254 (comment), let's see how he reply. I'll open an issue with more information.

@danielhollas
Copy link
Contributor

Thanks for filing the issue @unkcpz. I've marked this one as blocked since this needs to first be fixed in aiida-core and then we need to wait for a release and publish a new AiiDAlab image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This issue/PR is blocked by another issue/PR.
Projects
None yet
Development

No branches or pull requests

2 participants