Bug 1701701 - Allow for multiple pytest jobs when setting up harness symlink; r=ahal

When the fixture encounters FileExistsError for the harness symlink, the only apparent possibility is that another thread set up the symlink while this thread was trying to; no matter: as long as the symlink has been set up, everything should work.

Differential Revision: https://phabricator.services.mozilla.com/D161534
This commit is contained in:
Geoff Brown 2022-11-10 15:16:46 +00:00
parent b851d5b2e2
commit b4c0519da6

View File

@ -72,7 +72,11 @@ def setup_test_harness(request, flavor="plain"):
if hasattr(os, "symlink"):
if not os.path.isdir(os.path.dirname(test_root)):
os.makedirs(os.path.dirname(test_root))
os.symlink(files_dir, test_root)
try:
os.symlink(files_dir, test_root)
except FileExistsError:
# another pytest job set up the symlink - no problem
pass
else:
shutil.copytree(files_dir, test_root)
elif "TEST_HARNESS_ROOT" in os.environ: