Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: py_test does not work with bazel coverage #353

Open
jab opened this issue Jun 18, 2024 · 2 comments
Open

[Bug]: py_test does not work with bazel coverage #353

jab opened this issue Jun 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jab
Copy link

jab commented Jun 18, 2024

What happened?

Using bazel coverage with an aspect py_test target always results in no coverage data being collected.

Version

Development (host) and target OS/architectures:

Output of bazel --version: aspect 5.10.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: Current latest releases. See repro linked below.

Language(s) and/or frameworks involved: Python

How to reproduce

Please see https://github.com/jab/aspect-py-test-coverage-bug for a minimal reproduction.

@jab jab added the bug Something isn't working label Jun 18, 2024
@jab jab changed the title [Bug]: [Bug]: py_test does not work with bazel coverage Jun 18, 2024
@alexeagle
Copy link
Member

#303 seems related - I see you aren't using a py_pytest_main so I'm not sure if the workaround there is useful.

@jab
Copy link
Author

jab commented Jun 19, 2024

I didn't use py_pytest_main so as to provide a more minimal reproduction. But I am interested in experimenting with py_pytest_main more at some point.

I did take a quick a look at #303, but since I prefer not to use pytest-cov, it didn't seem like it would apply to me. (I agree with the reasons in https://www.youtube.com/watch?v=sPgvHGkmd0U for preferring to use coverage.py to invoke my test runner directly, as bazel coverage does with py_test targets.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants