How do you generate Python coverage in bazel?

1.1k views Asked by At

I'm trying to generate Python coverage in bazel. I tried to run this command and an empty file was generated

$ bazelisk coverage //company/libs:foo_test
INFO: Using default value for --instrumentation_filter: "^//company/libs[/:]".
INFO: Override the above default with --instrumentation_filter
INFO: Analyzed target //company/libs:foo_test (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
Target //company/libs:foo_test up-to-date:
  bazel-bin/company/libs/foo_test
INFO: Elapsed time: 0.244s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
//company/libs:foo_test                                        (cached) PASSED in 0.8s

$ cat bazel-out/k8-fastbuild/testlogs/company/libs/foo_test/coverage.dat
$ cat bazel-out/k8-fastbuild/testlogs/company/libs/foo_test/baseline_coverage.dat

How do I run coverage, and generate data points for the files?

1

There are 1 answers

2
Japheth On

bazel coverage --combined_report=lcov [target]