From 22e46762f8736c67ab4804a13b6197cab17a27ac Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 28 May 2014 20:36:40 -0400 Subject: [PATCH] Catch File Exists on makedirs to better support parallel runs --- tests/test_cmdline_tool.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_cmdline_tool.py b/tests/test_cmdline_tool.py index 639279ee..5aa4aa4e 100755 --- a/tests/test_cmdline_tool.py +++ b/tests/test_cmdline_tool.py @@ -143,10 +143,18 @@ def run_test(testname, cmd, args): cmdname = os.path.split(options.cmd)[1] if options.generate: - if not os.path.exists(expecteddir): os.makedirs(expecteddir) + if not os.path.exists(expecteddir): + try: + os.makedirs(expecteddir) + except OSError as e: + if e.errno != 17: raise e # catch File Exists to allow parallel runs outputname = expectedfilename else: - if not os.path.exists(actualdir): os.makedirs(actualdir) + if not os.path.exists(actualdir): + try: + os.makedirs(actualdir) + except OSError as e: + if e.errno != 17: raise e # catch File Exists to allow parallel runs outputname = actualfilename outputname = os.path.normpath(outputname)