Skip to content

Commit

Permalink
Add unit test to verify basic behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
mishazharov committed Dec 24, 2023
1 parent 117608d commit c60b21f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/py_runtime/pretend_binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

exit 0
26 changes: 26 additions & 0 deletions tests/py_runtime/py_runtime_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,32 @@ def _test_system_interpreter_must_be_absolute_impl(env, target):

_tests.append(_test_system_interpreter_must_be_absolute)

def _test_interpreter_sh_binary_target(name):
native.sh_binary(
name = "built_interpreter",
srcs = [":pretend_binary"],
)

rt_util.helper_target(
py_runtime,
name = name + "_subject",
interpreter = ":built_interpreter",
python_version = "PY3",
)
analysis_test(
name = name,
target = name + "_subject",
impl = _test_interpreter_sh_binary_target_impl,
)

def _test_interpreter_sh_binary_target_impl(env, target):
env.expect.that_target(target).provider(
PyRuntimeInfo,
factory = py_runtime_info_subject,
).interpreter_path().equals(None)

_tests.append(_test_interpreter_sh_binary_target)

def py_runtime_test_suite(name):
test_suite(
name = name,
Expand Down

0 comments on commit c60b21f

Please sign in to comment.