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

Ensure filehandles are closed, processes are finished #136

Merged
merged 2 commits into from
Dec 13, 2019

Conversation

llimeht
Copy link
Contributor

@llimeht llimeht commented Dec 12, 2019

The test suite generates a lot of ResourceWarning errors from filehandles that are not closed or subprocess.Popen calls that are not correctly finalised.

Example:

unittests/FunctionalTests.py::test
  /tmp/autopkgtest.AfpzrA/autopkgtest_tmp/unittests/FunctionalTests.py:96: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/autopkgtest.AfpzrA/autopkgtest_tmp/unittests/Packages/benchmarks/babel.html' mode='r' encoding='ANSI_X3.4-1968'>
    bench = open(benchfile).readlines()

unittests/FunctionalTests.py::test
  /usr/lib/python3.7/subprocess.py:883: ResourceWarning: subprocess 392 is still running
    ResourceWarning, source=self)

This PR uses context managers for the file handles and calls wait() to reap the subprocess correctly.

@PatrickMassot PatrickMassot merged commit b561804 into plastex:master Dec 13, 2019
@llimeht llimeht deleted the tmp/test-warnings branch December 15, 2019 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants