Skip to content

Commit

Permalink
fixup! fixup! fixup! test(core): Add analysis tests for base Python r…
Browse files Browse the repository at this point in the history
…ules.
  • Loading branch information
rickeylev committed Feb 27, 2023
1 parent f09fdb8 commit 2e2e0de
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tools/build_defs/python/tests/py_executable_base_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ load("@rules_testing//lib:analysis_test.bzl", "analysis_test")
load("@rules_testing//lib:truth.bzl", "matching")
load("@rules_testing//lib:util.bzl", rt_util = "util")
load("//tools/build_defs/python/tests:base_tests.bzl", "create_base_tests")
load("//tools/build_defs/python/tests:util.bzl", pt_util = "util")
load("//tools/build_defs/python/tests:util.bzl", "WINDOWS_ATTR", pt_util = "util")

_tests = []

Expand All @@ -31,13 +31,19 @@ def _test_executable_in_runfiles(name, config):
name = name,
impl = _test_executable_in_runfiles_impl,
target = name + "_subject",
attrs = WINDOWS_ATTR,
)

_tests.append(_test_executable_in_runfiles)

def _test_executable_in_runfiles_impl(env, target):
if pt_util.is_windows(env):
exe = ".exe"
else:
exe = ""

env.expect.that_target(target).runfiles().contains_at_least([
"{workspace}/{package}/{test_name}_subject",
"{workspace}/{package}/{test_name}_subject" + exe,
])

def _test_default_main_can_be_generated(name, config):
Expand Down Expand Up @@ -186,9 +192,7 @@ def _test_files_to_build(name, config):
name = name,
impl = _test_files_to_build_impl,
target = name + "_subject",
attrs = {
"windows": attr.label(default = "@platforms//os:windows"),
},
attrs = WINDOWS_ATTR,
)

_tests.append(_test_files_to_build)
Expand Down

0 comments on commit 2e2e0de

Please sign in to comment.