@@ -286,6 +286,21 @@ def selector_omits_flaky_tests_target(name, tags = None):
286286 tags = tags ,
287287 )
288288
289+ def selector_external_module_runfiles_target (name , tags = None ):
290+ topt_py_payloads_selector (
291+ name = name ,
292+ explicit_identifier = "example/python/pkg" ,
293+ imports = [],
294+ deps = [],
295+ attribute_candidates = [],
296+ fallback_identifier = "example/python/pkg" ,
297+ full_files = "@test_optimization_data_python//:test_optimization_files" ,
298+ module_group_names = ["module_example_python_pkg" ],
299+ module_groups = ["@test_optimization_data_python//:module_example_python_pkg" ],
300+ include_per_module = True ,
301+ tags = tags ,
302+ )
303+
289304def _has_fragment (items , fragment ):
290305 for item in items :
291306 if fragment in item :
@@ -403,6 +418,20 @@ def _selector_omits_flaky_tests_test_impl(ctx):
403418 asserts .false (env , _has_suffix (symlink_paths , "/flaky_tests.json" ), "unexpected flaky_tests.json symlink: %s" % symlink_paths )
404419 return analysistest .end (env )
405420
421+ def _selector_external_module_runfiles_test_impl (ctx ):
422+ env = analysistest .begin (ctx )
423+ target = analysistest .target_under_test (env )
424+ symlink_paths = [s .path for s in target [DefaultInfo ].default_runfiles .symlinks .to_list ()]
425+ root_symlink_paths = [s .path for s in target [DefaultInfo ].default_runfiles .root_symlinks .to_list ()]
426+ _assert_core_cache_symlinks (env , root_symlink_paths )
427+ asserts .equals (env , [], symlink_paths )
428+ asserts .false (
429+ env ,
430+ _has_suffix (root_symlink_paths , "/flaky_tests.json" ),
431+ "unexpected flaky_tests.json root symlink: %s" % root_symlink_paths ,
432+ )
433+ return analysistest .end (env )
434+
406435selector_explicit_precedence_test = analysistest .make (
407436 _selector_explicit_precedence_test_impl ,
408437)
@@ -444,3 +473,6 @@ selector_override_miss_failure_test = analysistest.make(
444473selector_omits_flaky_tests_test = analysistest .make (
445474 _selector_omits_flaky_tests_test_impl ,
446475)
476+ selector_external_module_runfiles_test = analysistest .make (
477+ _selector_external_module_runfiles_test_impl ,
478+ )
0 commit comments