pin virtualenv to <20 on windows

list dir in test 

use bin directory in pypy
This commit is contained in:
Grzegorz Bokota
2020-03-02 15:01:02 +01:00
parent e0c456604d
commit 6e41e729fe
2 changed files with 20 additions and 5 deletions
+15 -5
View File
@@ -188,15 +188,25 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
if test_command:
# set up a virtual environment to install and test from, to make sure
# there are no dependencies that were pulled in at build time.
shell(['pip', 'install', 'virtualenv'], env=env)
shell(['pip', 'install', '"virtualenv<20"'], env=env)
venv_dir = tempfile.mkdtemp()
shell(['python', '-m', 'virtualenv', venv_dir], env=env)
virtualenv_env = env.copy()
virtualenv_env['PATH'] = os.pathsep.join([
os.path.join(venv_dir, 'Scripts'),
virtualenv_env['PATH'],
])
if os.path.exists(os.path.join(venv_dir, 'Scripts')):
virtualenv_env['PATH'] = os.pathsep.join([
os.path.join(venv_dir, 'Scripts'),
virtualenv_env['PATH'],
])
elif os.path.exists(os.path.join(venv_dir, 'bin')):
# pypy2.7 bugfix
virtualenv_env['PATH'] = os.pathsep.join([
os.path.join(venv_dir, 'bin'),
virtualenv_env['PATH'],
])
else:
print("Fail to create virtualenv", file=sys.stderr)
sys.exit(2)
virtualenv_env["__CIBW_VIRTUALENV_PATH__"] = venv_dir
# check that we are using the Python from the virtual environment
+5
View File
@@ -24,5 +24,10 @@ class TestSpam(TestCase):
print("=[executable]", sys.executable)
print("=[spam location]", spam.__file__)
print("=[virtualenv path]", virtualenv_path)
print("=[listdir]", os.listdir(virtualenv_path))
if os.path.exists(os.path.join(virtualenv_path, 'Scripts')):
print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'Scripts')))
if os.path.exists(os.path.join(virtualenv_path, 'bin')):
print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'bin')))
self.assertTrue(virtualenv_path in normalize_path(sys.executable))
self.assertTrue(virtualenv_path in normalize_path(spam.__file__))