restore sys.path with <finally> statement

This commit is contained in:
kpnr
2019-12-16 21:17:16 +03:00
committed by GitHub
parent 1ca9dacbfe
commit c4e60b5b9c

View File

@@ -40,10 +40,13 @@ def test_ModuleAnalyzer_for_module(rootdir):
assert analyzer.encoding == None
path = rootdir / 'test-pycode'
sys.path.insert(0, path)
analyzer = ModuleAnalyzer.for_module('cp_1251_coded')
docs = analyzer.find_attr_docs()
sys.path.pop(0)
assert docs == {('', 'X'): ['It MUST look like X="\u0425"', '']}
try:
analyzer = ModuleAnalyzer.for_module('cp_1251_coded')
docs = analyzer.find_attr_docs()
assert docs == {('', 'X'): ['It MUST look like X="\u0425"', '']}
finally:
sys.path.pop(0)
def test_ModuleAnalyzer_for_file_in_egg(rootdir):