diff --git a/examples/pytest/BUILD.bazel b/examples/pytest/BUILD.bazel index 24c0d607..9c6401d0 100644 --- a/examples/pytest/BUILD.bazel +++ b/examples/pytest/BUILD.bazel @@ -1,4 +1,6 @@ load("@aspect_rules_py//py:defs.bzl", "py_pytest_main", "py_test") +load("@rules_python//python:defs.bzl", upstream_py_test = "py_test") +load(":foo.bzl", "lol_test") py_pytest_main( name = "__test__", @@ -11,6 +13,9 @@ py_test( "foo_test.py", ":__test__", ], + exec_properties = { + "test.someThing": "bar", + }, imports = ["../.."], main = ":__test__.py", package_collisions = "warning", @@ -21,3 +26,32 @@ py_test( "@pypi_pytest//:pkg", ], ) + +upstream_py_test( + name = "upstream_pytest_test", + srcs = [ + "foo_test.py", + ":__test__", + ], + env_inherit = [ + "FOO", + ], + exec_properties = { + "test.dockerNet": "bar", + }, + imports = ["../.."], + main = ":__test__.py", + deps = [ + ":__test__", + "@pypi_ftfy//:pkg", + "@pypi_neptune//:pkg", + "@pypi_pytest//:pkg", + ], +) + +lol_test( + name = "a", + exec_properties = { + "test.dockerNet": "a", + }, +) diff --git a/examples/pytest/foo.bzl b/examples/pytest/foo.bzl new file mode 100644 index 00000000..fc0e2644 --- /dev/null +++ b/examples/pytest/foo.bzl @@ -0,0 +1,11 @@ +def _impl(ctx): + e = ctx.actions.declare_file(ctx.label.name) + ctx.actions.write(e, content = "exit 0") + return DefaultInfo( + executable = e, + ) + +lol_test = rule( + implementation = _impl, + test = True, +)