Skip to content

Commit 6e6d2be

Browse files
authored
emit junit results in a monorepo-friendly way (#1231)
1 parent 8b67765 commit 6e6d2be

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Makefile

+9-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export CODECOV_TOKEN=${CODECOV_UPLOAD_TOKEN}
1919
API_DOMAIN ?= api
2020
PROXY_NETWORK ?= api_default
2121

22+
# We allow this to be overridden so that we can run `pytest` from this directory
23+
# but have the junit file use paths relative to a parent directory. This will
24+
# help us move to a monorepo.
25+
PYTEST_ROOTDIR ?= "."
26+
2227
# Codecov CLI version to use
2328
CODECOV_CLI_VERSION := 9.0.4
2429

@@ -30,13 +35,13 @@ check-for-migration-conflicts:
3035
python manage.py check_for_migration_conflicts
3136

3237
test:
33-
COVERAGE_CORE=sysmon pytest --cov=./ --junitxml=junit.xml -o junit_family=legacy
38+
COVERAGE_CORE=sysmon pytest --cov=./ --junitxml=junit.xml -o junit_family=legacy -c pytest.ini --rootdir=${PYTEST_ROOTDIR}
3439

3540
test.unit:
36-
COVERAGE_CORE=sysmon pytest --cov=./ -m "not integration" --cov-report=xml:unit.coverage.xml --junitxml=unit.junit.xml -o junit_family=legacy
41+
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}
3742

3843
test.integration:
39-
COVERAGE_CORE=sysmon pytest --cov=./ -m "integration" --cov-report=xml:integration.coverage.xml --junitxml=integration.junit.xml -o junit_family=legacy
44+
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}
4045

4146
lint:
4247
make lint.install
@@ -211,7 +216,7 @@ test_env.container_check_db:
211216
while ! nc -vz timescale 5432; do sleep 1; echo "waiting for timescale"; done
212217

213218
test_env.run_unit:
214-
docker compose exec api make test.unit
219+
docker compose exec api make test.unit PYTEST_ROOTDIR=${PYTEST_ROOTDIR}
215220

216221
test_env.run_integration:
217222
# docker compose exec api make test.integration

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ dev-dependencies = [
7474
]
7575

7676
[tool.uv.sources]
77-
shared = { git = "https://github.com/codecov/shared", rev = "87e34049b82aed55d9924af490c9efc27083eed9" }
77+
shared = { git = "https://github.com/codecov/shared", rev = "af74ab881368fa0e8ea3777404443ac4c525835a" }

uv.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)