Skip to content

Commit f91fc2f

Browse files
committed
use sysconfig from pep425tags and use mock's patch context mgr
1 parent 8df656b commit f91fc2f

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tests/unit/test_wheel.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,33 +150,27 @@ def test_unpack_wheel_no_flatten(self):
150150
finally:
151151
rmtree(tmpdir)
152152
pass
153-
153+
154154
def test_purelib_platlib(self):
155155
"""
156156
Test the "wheel is purelib/platlib" code.
157157
"""
158158
packages = [("pure_wheel", "data/packages/pure_wheel-1.7", True),
159-
("plat_wheel", "data/packages/plat_wheel-1.7", False)]
159+
("plat_wheel", "data/packages/plat_wheel-1.7", False)]
160160
for name, path, expected in packages:
161161
assert wheel.root_is_purelib(name, path) == expected
162162

163163
class TestPEP425Tags(object):
164-
164+
165165
def test_broken_sysconfig(self):
166166
"""
167167
Test that pep425tags still works when sysconfig is broken.
168168
Can be a problem on Python 2.7
169169
Issue #1074.
170170
"""
171-
import sysconfig
172171
import pip.pep425tags
173172
def raises_ioerror(var):
174173
raise IOError("I have the wrong path!")
175-
176-
original = sysconfig.get_config_var
177-
sysconfig.get_config_var = raises_ioerror
178-
try:
174+
with patch('pip.pep425tags.sysconfig.get_config_var', raises_ioerror):
179175
assert len(pip.pep425tags.get_supported())
180-
finally:
181-
sysconfig.get_config_var = original
182176

0 commit comments

Comments
 (0)