-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
make sure citations file closed after read #1620
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1620 +/- ##
===========================================
- Coverage 97.99% 97.99% -0.01%
===========================================
Files 328 327 -1
Lines 18676 18666 -10
===========================================
- Hits 18301 18291 -10
Misses 375 375
Continue to review full report at Codecov.
|
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.
Looks good, thanks @chuckliu1979! Before merging, can you add a line to CHANGELOG under the bug fixes section explaining what you did?
@all-contributors please add @chuckliu1979 for bug report and code |
I've put up a pull request to add @chuckliu1979! 🎉 |
sure. new commit added |
Description
citations file not closed in pybamm.citations.Citations.read_citations which causes pytest failed if import pybamm:
_pytest/unraisableexception.py:78: in unraisable_exception_runtest_hook
warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E pytest.PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]>
E
E Traceback (most recent call last):
E File "pybamm/citations.py", line 45, in read_citations
E for line in open(citations_file):
E ResourceWarning: unclosed file <_io.TextIOWrapper name='pybamm/CITATIONS.txt' mode='r' encoding='UTF-8'>
Fixes # (issue)
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ flake8
$ python run-tests.py --unit
$ cd docs
and then$ make clean; make html
You can run all three at once, using
$ python run-tests.py --quick
.Further checks: