Normalise `sys.path` manipulation in tests (#12665)

This commit is contained in:
Adam Turner authored and GitHub committed 2024-07-23 16:55:21 +01:00
1 parent a69ca674cc
commit 7c4db269af
37 files changed
+87 -85

No files matched your search

+3 -3
View File
@@ -40,14 +40,14 @@ def test_ModuleAnalyzer_for_module(rootdir):
assert analyzer.srcname in (SPHINX_MODULE_PATH,
os.path.abspath(SPHINX_MODULE_PATH))
path = str(rootdir / 'test-pycode')
sys.path.insert(0, path)
saved_path = sys.path.copy()
sys.path.insert(0, str(rootdir / 'test-pycode'))
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)
sys.path[:] = saved_path
def test_ModuleAnalyzer_find_tags():