Skip to content

Commit d8f05e7

Browse files
hodlinatorryanofsky
andcommitted
qa: Fix dormant bug caused by multiple --tmpdir
We would only modify the parent process' first --tmpdir arg. Now we tack on an additional --tmpdir after the parent's arguments. Also simplifies the code. Co-authored-by: Ryan Ofsky <[email protected]>
1 parent ad5cd12 commit d8f05e7

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

test/functional/feature_framework_startup_failures.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,11 @@ def setup_network(self):
3636
# Launches a child test process that runs this same file, but instantiates
3737
# a child test. Verifies that it raises only the expected exception, once.
3838
def _verify_startup_failure(self, test, internal_args, expected_exception):
39-
# Inherit args from parent, only modifying tmpdir so children don't fail
40-
# as a cause of colliding with the parent dir.
41-
parent_args = sys.argv.copy()
39+
# Inherit sys.argv from parent, only overriding tmpdir to a subdirectory
40+
# so children don't fail due to colliding with the parent dir.
4241
assert self.options.tmpdir, "Framework should always set tmpdir."
43-
i, path = next(((i, m[1]) for i, arg in enumerate(parent_args) if (m := re.match(r'--tm(?:p(?:d(?:ir?)?)?)?=(.+)', arg))),
44-
(len(parent_args), self.options.tmpdir))
4542
subdir = md5(expected_exception.encode('utf-8')).hexdigest()[:8]
46-
parent_args[i:i + 1] = [f"--tmpdir={path}/{subdir}"]
47-
args = [sys.executable] + parent_args + [f"--internal_test={test.__name__}"] + internal_args
43+
args = [sys.executable] + sys.argv + [f"--tmpdir={self.options.tmpdir}/{subdir}", f"--internal_test={test.__name__}"] + internal_args
4844

4945
try:
5046
# The subprocess encoding argument gives different results for e.output

0 commit comments

Comments
 (0)