diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bf1c3806..46061f0b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -66,7 +66,7 @@ jobs: steps: - uses: actions/checkout@v4 - run: ./minimal_download_test.sh - - run: bazel coverage //src/... + - run: bazel coverage //... - uses: hrishikesh-kadam/setup-lcov@6c1aa0cc9e1c02f9f58f01ac599f1064ccc83470 # v1 # The github-actions-report-lcov doesn't follow symlinks, so get an absolute path - run: echo "bazel_testlogs=$(bazel info bazel-testlogs)" >> $GITHUB_ENV diff --git a/e2e/use_release/.bazelrc b/e2e/use_release/.bazelrc index e3d9b5bf..1bcd5a1a 100644 --- a/e2e/use_release/.bazelrc +++ b/e2e/use_release/.bazelrc @@ -1,3 +1,3 @@ -# Don't instrument the root folder, since that walks into the //external folder too +# Don't instrument the //external folder # See https://bazelbuild.slack.com/archives/C07HTMQFTBN/p1737600241213179?thread_ts=1736875351.548719&cid=C07HTMQFTBN -coverage --instrumentation_filter=//src +coverage --instrumentation_filter=^// diff --git a/e2e/use_release/BUILD.bazel b/e2e/use_release/BUILD.bazel index 5738cb27..0f5a3fab 100644 --- a/e2e/use_release/BUILD.bazel +++ b/e2e/use_release/BUILD.bazel @@ -1,3 +1,31 @@ -load("@rules_uv//uv:pip.bzl", "pip_compile") +load("@aspect_rules_py//py:defs.bzl", "py_library", "py_pytest_main", "py_test") -pip_compile(name = "pip_compile") +py_library( + name = "lib", + srcs = ["__init__.py"], +) + +# TODO(alex): land https://github.com/aspect-build/rules_py/pull/401 and shorten this +py_pytest_main( + name = "__test__", + deps = [ + "@pip//coverage", + "@pip//pytest", + ], +) + +py_test( + name = "test", + srcs = [ + "my_test.py", + ":__test__", + ], + main = ":__test__.py", + deps = [ + ":__test__", + ":lib", + ], +) + +# comment out because it produces an empty coverage.dat file and the GHA I'm using fails +# pip_compile(name = "pip_compile") diff --git a/e2e/use_release/__init__.py b/e2e/use_release/__init__.py new file mode 100644 index 00000000..8d52021a --- /dev/null +++ b/e2e/use_release/__init__.py @@ -0,0 +1,8 @@ +def welcome(name): + return "hello %s" % name + + + + + + diff --git a/e2e/use_release/my_test.py b/e2e/use_release/my_test.py new file mode 100644 index 00000000..4f8c2a00 --- /dev/null +++ b/e2e/use_release/my_test.py @@ -0,0 +1,9 @@ +from __init__ import welcome + +def test_welcome(): + greeting = welcome("world") + assert greeting == "hello world" + + + +