From 5bc875ba56bc6dee19e60c441ae68dc446bfd4f8 Mon Sep 17 00:00:00 2001 From: Alex Hornby Date: Wed, 19 Feb 2025 13:18:31 -0800 Subject: [PATCH] fix test execution when building OSS repo with tpx on path Summary: X-link: https://github.com/facebookincubator/fizz/pull/160 X-link: https://github.com/facebookincubator/zstrong/pull/1192 Fix case when testing a github repo checkout, wth tpx on path, where --no-testpilot not specified. As workaround before this lands, if in this situation pass --no-testpilot Reviewed By: bigfootjon Differential Revision: D69852662 fbshipit-source-id: 5065cdf3acae3bc9c90df89ed96eab3fc3e19906 --- build/fbcode_builder/getdeps/builder.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build/fbcode_builder/getdeps/builder.py b/build/fbcode_builder/getdeps/builder.py index 83916fde9..534f9092c 100644 --- a/build/fbcode_builder/getdeps/builder.py +++ b/build/fbcode_builder/getdeps/builder.py @@ -979,13 +979,19 @@ def list_tests(): # better signals for flaky tests. retry = 0 - tpx = path_search(env, "tpx") + tpx = None + try: + from .facebook.testinfra import start_run + + tpx = path_search(env, "tpx") + except ImportError: + # internal testinfra not available + pass + if tpx and not no_testpilot: buck_test_info = list_tests() import os - from .facebook.testinfra import start_run - buck_test_info_name = os.path.join(self.build_dir, ".buck-test-info.json") with open(buck_test_info_name, "w") as f: json.dump(buck_test_info, f)