Commit 651f97af authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #1152 from jdufresne/resource-warnings

Clean up resource warnings during tests
parents f7ac2329 b1e47b43
...@@ -2124,7 +2124,11 @@ def non_empty_lines(path): ...@@ -2124,7 +2124,11 @@ def non_empty_lines(path):
""" """
Yield non-empty lines from file at path Yield non-empty lines from file at path
""" """
return (line.rstrip() for line in open(path) if line.strip()) with open(path) as f:
for line in f:
line = line.strip()
if line:
yield line
def resolve_egg_link(path): def resolve_egg_link(path):
......
...@@ -92,7 +92,7 @@ class TestZipProvider(object): ...@@ -92,7 +92,7 @@ class TestZipProvider(object):
ts = timestamp(self.ref_time) ts = timestamp(self.ref_time)
os.utime(filename, (ts, ts)) os.utime(filename, (ts, ts))
filename = zp.get_resource_filename(manager, 'data.dat') filename = zp.get_resource_filename(manager, 'data.dat')
f = open(filename) with open(filename) as f:
assert f.read() == 'hello, world!' assert f.read() == 'hello, world!'
manager.cleanup_resources() manager.cleanup_resources()
......
...@@ -164,7 +164,8 @@ class TestEggInfo(object): ...@@ -164,7 +164,8 @@ class TestEggInfo(object):
self._run_install_command(tmpdir_cwd, env) self._run_install_command(tmpdir_cwd, env)
egg_info_dir = self._find_egg_info_files(env.paths['lib']).base egg_info_dir = self._find_egg_info_files(env.paths['lib']).base
sources_txt = os.path.join(egg_info_dir, 'SOURCES.txt') 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): def _setup_script_with_requires(self, requires, use_setup_cfg=False):
setup_script = DALS( setup_script = DALS(
...@@ -447,7 +448,8 @@ class TestEggInfo(object): ...@@ -447,7 +448,8 @@ class TestEggInfo(object):
self._run_install_command(tmpdir_cwd, env) self._run_install_command(tmpdir_cwd, env)
egg_info_dir = self._find_egg_info_files(env.paths['lib']).base egg_info_dir = self._find_egg_info_files(env.paths['lib']).base
pkginfo = os.path.join(egg_info_dir, 'PKG-INFO') 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): def test_manifest_maker_warning_suppression(self):
fixtures = [ fixtures = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment