summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-08-30 07:16:48 +0200
committerJürg Billeter <j@bitron.ch>2019-08-30 07:30:10 +0200
commit23e79a03d06fdf2aca55ba6f800cced8b400dfbe (patch)
tree2bcc69b230cc16793175e727e0071e90ca015178 /tests
parentd7db365912a2c34118b6e6b8c638d52666f8ecb5 (diff)
downloadbuildstream-23e79a03d06fdf2aca55ba6f800cced8b400dfbe.tar.gz
tests/testutils/repo/bzr.py: Work around race condition in bzrjuerg/tox-home
This works around a TOCTTOU race condition in bzr's creation of ~/.bazaar in ensure_config_dir_exists() when running tests in parallel.
Diffstat (limited to 'tests')
-rw-r--r--tests/testutils/repo/bzr.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/testutils/repo/bzr.py b/tests/testutils/repo/bzr.py
index 7b2392f46..074712af1 100644
--- a/tests/testutils/repo/bzr.py
+++ b/tests/testutils/repo/bzr.py
@@ -18,6 +18,11 @@ class Bzr(Repo):
self.env.update(BZR_ENV)
def create(self, directory):
+ # Work around race condition in bzr's creation of ~/.bazaar in
+ # ensure_config_dir_exists() when running tests in parallel.
+ bazaar_config_dir = os.path.expanduser('~/.bazaar')
+ os.makedirs(bazaar_config_dir, exist_ok=True)
+
branch_dir = os.path.join(self.repo, 'trunk')
subprocess.call([self.bzr, 'init-repo', self.repo], env=self.env)