summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-18 16:23:05 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-18 16:23:05 -0500
commitadfb929141903129708fe05189303d72116e82fa (patch)
tree40e4ed8024ae9aca1d13a09990ef1bfe06c4a543
parent73c7252d339d8761d9f97fe5ac1355f6a2c1057f (diff)
downloadbuildstream-adfb929141903129708fe05189303d72116e82fa.tar.gz
tests/testutils/python_repo.py: Use subprocess to run sdist
The current approach using setuptools.sandbox.run_setup() was causing a spurious (but highly frequent) failure where setuptools gets mixed up with it's manipulation of sys.modules and hits a RuntimeError as a dictionary changes size while being iterated over. For instance: https://gitlab.com/BuildStream/buildstream/-/jobs/147967307 Since this already happens in an isolated virtual environment created by tox, we should not need additional sandboxing here from setuptools, and launching this as a subprocess will be safer.
-rw-r--r--tests/testutils/python_repo.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/testutils/python_repo.py b/tests/testutils/python_repo.py
index 9cda5e910..386e67014 100644
--- a/tests/testutils/python_repo.py
+++ b/tests/testutils/python_repo.py
@@ -1,8 +1,8 @@
-from setuptools.sandbox import run_setup
import os
import pytest
import re
import shutil
+import subprocess
SETUP_TEMPLATE = '''\
@@ -88,7 +88,9 @@ def generate_pip_package(tmpdir, pypi, name, version='0.1'):
f.write(INIT_TEMPLATE.format(name=name))
os.chmod(main_file, 0o644)
- run_setup(setup_file, ['sdist'])
+ # Run sdist with a fresh process
+ p = subprocess.run(['python3', 'setup.py', 'sdist'], cwd=tmpdir)
+ assert p.returncode == 0
# create directory for this package in pypi resulting in a directory
# tree resembling the following structure: