Skip to content

Commit 314d51d

Browse files
committed
test: do pre-PR A/B-test checkout into temporary directory
Otherwise, they clash with the directories used for the pre-compiled binaries (as the `build`-subdirectories now no longer contain checked out repositories, but instead only binaries). Since each pipeline only uses git_ab_test in precisely one test, loosing the re-use is not a big deal. Signed-off-by: Patrick Roy <[email protected]>
1 parent 14e4b60 commit 314d51d

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

tests/framework/ab_test.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import os
2525
import statistics
2626
from pathlib import Path
27+
from tempfile import TemporaryDirectory
2728
from typing import Callable, List, Optional, TypeVar
2829

2930
import scipy
@@ -82,19 +83,20 @@ def git_ab_test(
8283
(alternatively, your comparator can perform any required assertions and not return anything).
8384
"""
8485

85-
dir_a = git_clone(Path("../build") / a_revision, a_revision)
86-
result_a = test_runner(dir_a, True)
86+
with TemporaryDirectory() as tmp_dir:
87+
dir_a = git_clone(Path(tmp_dir) / a_revision, a_revision)
88+
result_a = test_runner(dir_a, True)
8789

88-
if b_revision:
89-
dir_b = git_clone(Path("../build") / b_revision, b_revision)
90-
else:
91-
# By default, pytest execution happens inside the `tests` subdirectory. Pass the repository root, as
92-
# documented.
93-
dir_b = Path.cwd().parent
94-
result_b = test_runner(dir_b, False)
90+
if b_revision:
91+
dir_b = git_clone(Path(tmp_dir) / b_revision, b_revision)
92+
else:
93+
# By default, pytest execution happens inside the `tests` subdirectory. Pass the repository root, as
94+
# documented.
95+
dir_b = Path.cwd().parent
96+
result_b = test_runner(dir_b, False)
9597

96-
comparison = comparator(result_a, result_b)
97-
return result_a, result_b, comparison
98+
comparison = comparator(result_a, result_b)
99+
return result_a, result_b, comparison
98100

99101

100102
DEFAULT_A_DIRECTORY = FC_WORKSPACE_DIR / "build" / "main"

0 commit comments

Comments
 (0)