From f17afc65198da00545672189483acaa74f56a3ed Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 30 Dec 2017 03:15:23 +0100 Subject: [PATCH] Try to avoid the pth tests not working because of the created virtualenv in tox --- test/test_evaluate/test_sys_path.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/test_evaluate/test_sys_path.py b/test/test_evaluate/test_sys_path.py index b9fdda06..5bc585c7 100644 --- a/test/test_evaluate/test_sys_path.py +++ b/test/test_evaluate/test_sys_path.py @@ -33,7 +33,20 @@ def test_venv_and_pths(tmpdir, environment): # Ignore if it fails. It usually fails if it's not able to properly install # pip. However we don't need that for this test. - os.system(environment._executable + ' -m venv ' + dirname) + executable_path = '/usr/bin/' + os.path.basename(environment._executable) + if not os.path.exists(executable_path): + # Need to not use the path in the virtualenv. Since tox creates + # virtualenvs we cannot reuse them, because they have different site.py + # files that work differently than the default ones. + # Since nobody creates venv's from within virtualenvs (doesn't make + # sense and people are hopefully starting to avoid virtualenv now - + # because it's more complicated than venv), it's the correct approach + # to just use the systems Python directly. + # This doesn't work for windows and others, but I currently don't care. + # Feel free to improve. + pytest.skip() + + os.system(executable_path + ' -m venv ' + dirname) # We cannot find the virtualenv in some cases, because the virtualenv was # not created correctly.