From aae2a8e3ed82774bb258340ab765b57c2942d17a Mon Sep 17 00:00:00 2001 From: Peter Law Date: Mon, 13 Feb 2023 20:25:31 +0000 Subject: [PATCH] Cope with Windows virtualenvs different casing --- test/test_inference/test_sys_path.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/test_inference/test_sys_path.py b/test/test_inference/test_sys_path.py index 2fa0e4df..a725cd24 100644 --- a/test/test_inference/test_sys_path.py +++ b/test/test_inference/test_sys_path.py @@ -30,14 +30,16 @@ def test_paths_from_assignment(Script): assert paths('sys.path, other = ["a"], 2') == set() -def test_venv_and_pths(venv_path): +def test_venv_and_pths(venv_path, environment): pjoin = os.path.join - site_pkg_path = pjoin(venv_path, 'lib') if os.name == 'nt': - site_pkg_path = pjoin(site_pkg_path, 'site-packages') + if environment.version_info < (3, 11): + site_pkg_path = pjoin(venv_path, 'lib', 'site-packages') + else: + site_pkg_path = pjoin(venv_path, 'Lib', 'site-packages') else: - site_pkg_path = glob(pjoin(site_pkg_path, 'python*', 'site-packages'))[0] + site_pkg_path = glob(pjoin(venv_path, 'lib', 'python*', 'site-packages'))[0] shutil.rmtree(site_pkg_path) shutil.copytree(get_example_dir('sample_venvs', 'pth_directory'), site_pkg_path)