Skip to content

Commit 2ddcf4d

Browse files
authored
fix(tests): add --cov-append to gapic-generator and proto-plus to preserve monorepo coverage (#17603)
The cover presubmit job failed in https://github.com/googleapis/google-cloud-python/actions/runs/28464524723/job/84362399849?pr=17600 with `No data to report` for `db-dtypes`. While most packages correctly use the `--cov-append` flag, both `gapic-generator` and `proto-plus` were missing it in their respective `noxfile.py` configurations. When their test suites executed, `pytest-cov` fell back to its default behavior and truncated the shared coverage file. This silently wiped out the coverage data of any packages that ran before them (such as `db-dtypes`), causing the downstream coverage aggregation job to fail. Changes - Added the `--cov-append` flag to the pytest commands in `packages/gapic-generator/noxfile.py`. - Added the `--cov-append` flag to the pytest commands in `packages/proto-plus/noxfile.py`. - Use `"--cov-fail-under=0",` when running `pytest` in `gapic-generator`. Each package should specify `fail_under` in `.coveragerc` This ensures these packages safely add their coverage data to the shared file without destroying the results of any packages that were tested before them.
1 parent 1f93a2b commit 2ddcf4d

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

packages/gapic-generator/noxfile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ def unit(session):
8282
"-vv",
8383
"-n=auto",
8484
"--cov=gapic",
85+
"--cov-append",
8586
"--cov-config=.coveragerc",
8687
"--cov-report=term",
87-
"--cov-fail-under=100",
88+
"--cov-fail-under=0",
8889
path.join("tests", "unit"),
8990
]
9091
),

packages/proto-plus/noxfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def unit(session, implementation):
8282
session.posargs # Coverage info when running individual tests is annoying.
8383
or [
8484
"--cov=proto",
85+
"--cov-append",
8586
"--cov-config=.coveragerc",
8687
"--cov-report=term",
8788
"--cov-report=html",

0 commit comments

Comments
 (0)