Skip to content

Commit 41863e5

Browse files
committed
Use temporary copy of cirq-core in test_isolated_packages
Avoid conflict between parallel builds of the cirq-core wheel.
1 parent 1238403 commit 41863e5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dev_tools/packaging/isolated_packages_test.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,22 @@
3232
# the "isolation" fails and for example cirq-core would be on the PATH
3333
@mock.patch.dict(os.environ, {"PYTHONPATH": ""})
3434
@pytest.mark.parametrize('module', list_modules(), ids=[m.name for m in list_modules()])
35-
def test_isolated_packages(cloned_env, module):
35+
def test_isolated_packages(cloned_env, module, tmp_path):
3636
env = cloned_env("isolated_packages", *PACKAGES)
3737

3838
if str(module.root) != "cirq-core":
3939
assert f'cirq-core=={module.version}' in module.install_requires
4040

41+
# TODO: Remove after upgrading package builds from setup.py to PEP-517
42+
# Create per-worker copy of cirq-core sources so that parallel builds
43+
# of cirq-core wheel do not conflict.
44+
opt_cirq_core = (
45+
[str(shutil.copytree("./cirq-core", tmp_path / "cirq-core"))]
46+
if str(module.root) != "cirq-core"
47+
else []
48+
)
4149
result = shell_tools.run(
42-
f"{env}/bin/pip install ./{module.root} ./cirq-core".split(),
50+
[f"{env}/bin/pip", "install", f"./{module.root}", *opt_cirq_core],
4351
stderr=subprocess.PIPE,
4452
check=False,
4553
)

0 commit comments

Comments
 (0)