aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_egg_info.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-09-16 11:23:22 -0700
committerJon Dufresne <jon.dufresne@gmail.com>2017-09-16 12:36:34 -0700
commitb1e47b43f3d2b972057ebe4c564b0ed03d39cd3d (patch)
treecbb27e7459cdf542a021ceecde51eab2a51a36ac /setuptools/tests/test_egg_info.py
parent9f295a706590b1e3618978d6f2d83af0b893ec4d (diff)
downloadexternal_python_setuptools-b1e47b43f3d2b972057ebe4c564b0ed03d39cd3d.tar.gz
external_python_setuptools-b1e47b43f3d2b972057ebe4c564b0ed03d39cd3d.tar.bz2
external_python_setuptools-b1e47b43f3d2b972057ebe4c564b0ed03d39cd3d.zip
Clean up resource warnings during tests
When tests are invoked with the Python flag -Wall, warnings appear in the form of: ResourceWarning: unclosed file ... Close all files and resources deterministically to avoid such warnings. Most often, easiest to do using a context manager.
Diffstat (limited to 'setuptools/tests/test_egg_info.py')
-rw-r--r--setuptools/tests/test_egg_info.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index e454694d..1411f93c 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -164,7 +164,8 @@ class TestEggInfo(object):
self._run_install_command(tmpdir_cwd, env)
egg_info_dir = self._find_egg_info_files(env.paths['lib']).base
sources_txt = os.path.join(egg_info_dir, 'SOURCES.txt')
- assert 'docs/usage.rst' in open(sources_txt).read().split('\n')
+ with open(sources_txt) as f:
+ assert 'docs/usage.rst' in f.read().split('\n')
def _setup_script_with_requires(self, requires, use_setup_cfg=False):
setup_script = DALS(
@@ -447,7 +448,8 @@ class TestEggInfo(object):
self._run_install_command(tmpdir_cwd, env)
egg_info_dir = self._find_egg_info_files(env.paths['lib']).base
pkginfo = os.path.join(egg_info_dir, 'PKG-INFO')
- assert 'Requires-Python: >=1.2.3' in open(pkginfo).read().split('\n')
+ with open(pkginfo) as f:
+ assert 'Requires-Python: >=1.2.3' in f.read().split('\n')
def test_manifest_maker_warning_suppression(self):
fixtures = [