Skip to content

Commit dc94af3

Browse files
authored
Added code coverage (#166)
## Changes Added code coverage ### Tests - [x] manually tested - [ ] added unit tests - [ ] added integration tests
1 parent 8710329 commit dc94af3

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

.codegen.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
"pre_setup": ["hatch env create"],
88
"prepend_path": ".venv/bin",
99
"acceptance_path": "tests/integration",
10-
"test": [
11-
"pytest -n 4 --cov src --cov-report=xml --timeout 30 tests/unit --durations 20"
12-
]
10+
"test": []
1311
}
1412
}

.github/workflows/acceptance.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ jobs:
4242
- name: Install hatch
4343
run: pip install hatch==1.9.4
4444

45-
- name: Run integration tests
46-
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.2
45+
- name: Run unit tests and generate test coverage report
46+
run: make test
47+
48+
- name: Run integration tests and generate test coverage report
49+
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.3
4750
with:
4851
vault_uri: ${{ secrets.VAULT_URI }}
4952
timeout: 2h
@@ -52,6 +55,12 @@ jobs:
5255
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
5356
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
5457

58+
# collects all coverage reports: coverage.xml from integration tests, coverage-unit.xml from unit tests
59+
- name: Publish test coverage
60+
uses: codecov/codecov-action@v5
61+
with:
62+
use_oidc: true
63+
5564
serverless_integration:
5665
# Only run this job for PRs from branches on the main repository and not from forks.
5766
# Workflows triggered by PRs from forks don't have access to the tool environment.
@@ -78,7 +87,7 @@ jobs:
7887
run: pip install hatch==1.9.4
7988

8089
- name: Run integration tests on serverless cluster
81-
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.2
90+
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.3
8291
with:
8392
vault_uri: ${{ secrets.VAULT_URI }}
8493
timeout: 2h

.github/workflows/push.yml

-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ jobs:
4545
pip install hatch==1.9.4
4646
make ci-test
4747
48-
- name: Publish test coverage
49-
uses: codecov/codecov-action@v5
50-
with:
51-
use_oidc: true
52-
5348
fmt:
5449
runs-on: ubuntu-latest
5550
steps:

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ python="3.10"
7878
path = ".venv"
7979

8080
[tool.hatch.envs.default.scripts]
81-
test = "pytest -n 10 --cov src --cov-report=xml --timeout 30 tests/unit --durations 20"
82-
coverage = "pytest -n 10 --cov src tests/ --timeout 480 --cov-report=html --durations 20"
83-
integration = "pytest -n 10 --timeout 480 --cov src tests/integration --durations 20"
81+
test = "pytest tests/unit/ -n 10 --cov --cov-report=xml:coverage-unit.xml --timeout 30 --durations 20"
82+
coverage = "pytest tests/ -n 10 --cov --cov-report=html --timeout 480 --durations 20"
83+
integration = "pytest tests/integration/ -n 10 --cov --cov-report=xml --cov-config=tests/integration/.coveragerc --timeout 480 --durations 20"
8484
fmt = ["black . --extend-exclude 'demos/'",
8585
"ruff check . --fix",
8686
"mypy . --exclude 'demos/*'",

tests/integration/.coveragerc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
source = src

0 commit comments

Comments
 (0)