Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 55547ae

Browse files
authored
emit junit results in a monorepo-friendly way (#1162)
1 parent 51eb407 commit 55547ae

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ VERSION := release-${sha}
1616
CODECOV_UPLOAD_TOKEN ?= "notset"
1717
CODECOV_STATIC_TOKEN ?= "notset"
1818
CODECOV_URL ?= "https://api.codecov.io"
19+
20+
# We allow this to be overridden so that we can run `pytest` from this directory
21+
# but have the junit file use paths relative to a parent directory. This will
22+
# help us move to a monorepo.
23+
PYTEST_ROOTDIR ?= "."
24+
1925
export DOCKER_BUILDKIT=1
2026
export WORKER_DOCKER_REPO=${AR_REPO}
2127
export WORKER_DOCKER_VERSION=${VERSION}
@@ -44,13 +50,13 @@ build.portable:
4450
--build-arg RELEASE_VERSION="${release_version}"
4551

4652
test:
47-
COVERAGE_CORE=sysmon pytest --cov=./ --junitxml=junit.xml -o junit_family=legacy
53+
COVERAGE_CORE=sysmon pytest --cov=./ --junitxml=junit.xml -o junit_family=legacy -c pytest.ini --rootdir=${PYTEST_ROOTDIR}
4854

4955
test.unit:
50-
COVERAGE_CORE=sysmon pytest --cov=./ -m "not integration" --cov-report=xml:unit.coverage.xml --junitxml=unit.junit.xml -o junit_family=legacy
56+
COVERAGE_CORE=sysmon pytest --cov=./ -m "not integration" --cov-report=xml:unit.coverage.xml --junitxml=unit.junit.xml -o junit_family=legacy -c pytest.ini --rootdir=${PYTEST_ROOTDIR}
5157

5258
test.integration:
53-
COVERAGE_CORE=sysmon pytest --cov=./ -m "integration" --cov-report=xml:integration.coverage.xml --junitxml=integration.junit.xml -o junit_family=legacy
59+
COVERAGE_CORE=sysmon pytest --cov=./ -m "integration" --cov-report=xml:integration.coverage.xml --junitxml=integration.junit.xml -o junit_family=legacy -c pytest.ini --rootdir=${PYTEST_ROOTDIR}
5460

5561
lint:
5662
make lint.install
@@ -228,10 +234,10 @@ test_env.container_check_db:
228234
while ! nc -vz timescale 5432; do sleep 1; echo "waiting for timescale"; done
229235

230236
test_env.run_unit:
231-
docker-compose exec worker make test.unit
237+
docker-compose exec worker make test.unit PYTEST_ROOTDIR=${PYTEST_ROOTDIR}
232238

233239
test_env.run_integration:
234-
docker-compose exec worker make test.integration
240+
docker-compose exec worker make test.integration PYTEST_ROOTDIR=${PYTEST_ROOTDIR}
235241

236242
test_env:
237243
make test_env.up

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ dev-dependencies = [
8383
[tool.uv.sources]
8484
timestring = { git = "https://github.com/codecov/timestring", rev = "d37ceacc5954dff3b5bd2f887936a98a668dda42" }
8585
test-results-parser = { git = "https://github.com/codecov/test-results-parser", rev = "190bbc8a911099749928e13d5fe57f6027ca1e74" }
86-
shared = { git = "https://github.com/codecov/shared", rev = "a93b0f1299841e56d8ceb591813974e97bec75b9" }
86+
shared = { git = "https://github.com/codecov/shared", rev = "af74ab881368fa0e8ea3777404443ac4c525835a" }

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)