Skip to content

Commit

Permalink
configure coverage and pytest junit output from pyproject
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Oct 8, 2024
1 parent 477b16b commit 9f344c2
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fix: fix-cpp fix-py ## Run project autofixers

.PHONY: tests-py tests-cpp tests test tests-ci
tests-py:
python -m pytest -v cpp_template/tests --junitxml=junit.xml --cov=cpp_template --cov-branch --cov-fail-under=65 --cov-report term-missing --cov-report xml
python -m pytest -v {{module}}/tests --cov={{module}} --cov-report term-missing --cov-report xml

tests-cpp:
echo "TODO C++ tests"
Expand Down
15 changes: 15 additions & 0 deletions cpp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,22 @@ environment = {CFLAGS="-I/usr/local/include -L/usr/local/lib", CXXFLAGS="-I/usr/
archs = "AMD64"
skip = "*win32 *arm_64"

[tool.coverage.run]
branch = true
omit = [
"{{module}}/tests/integration/",
]
[tool.coverage.report]
exclude_also = [
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
ignore_errors = true
fail_under = 50

[tool.pytest.ini_options]
addopts = ["-vvv", "--junitxml=junit.xml"]
asyncio_mode = "strict"
testpaths = "cpp_template/tests"

Expand Down
4 changes: 2 additions & 2 deletions js/Makefile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ annotate: ## run python type annotation checks with mypy
#########
.PHONY: test-py tests-py coverage-py
test-py: ## run python tests
python -m pytest -v {{module}}/tests --junitxml=junit.xml
python -m pytest -v {{module}}/tests

# alias
tests-py: test-py

coverage-py: ## run python tests and collect test coverage
python -m pytest -v {{module}}/tests --junitxml=junit.xml --cov={{module}} --cov-branch --cov-fail-under=50 --cov-report term-missing --cov-report xml
python -m pytest -v {{module}}/tests --cov={{module}} --cov-report term-missing --cov-report xml

.PHONY: test-js tests-js coverage-js
test-js: ## run js tests
Expand Down
15 changes: 15 additions & 0 deletions js/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@ ignore = [
"{{module}}/**/*",
]

[tool.coverage.run]
branch = true
omit = [
"{{module}}/tests/integration/",
]
[tool.coverage.report]
exclude_also = [
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
ignore_errors = true
fail_under = 50

[tool.hatch.build]
artifacts = [
"{{module}}/extension",
Expand Down Expand Up @@ -132,6 +146,7 @@ build_cmd = "build"
npm = "pnpm"

[tool.pytest.ini_options]
addopts = ["-vvv", "--junitxml=junit.xml"]
asyncio_mode = "strict"
testpaths = "{{module}}/tests"

Expand Down
4 changes: 2 additions & 2 deletions jupyter/Makefile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ annotate: ## run python type annotation checks with mypy
#########
.PHONY: test-py tests-py coverage-py
test-py: ## run python tests
python -m pytest -v {{module}}/tests --junitxml=junit.xml
python -m pytest -v {{module}}/tests

# alias
tests-py: test-py

coverage-py: ## run python tests and collect test coverage
python -m pytest -v {{module}}/tests --junitxml=junit.xml --cov={{module}} --cov-branch --cov-fail-under=50 --cov-report term-missing --cov-report xml
python -m pytest -v {{module}}/tests --cov={{module}} --cov-report term-missing --cov-report xml

.PHONY: test-js tests-js coverage-js
test-js: ## run js tests
Expand Down
15 changes: 15 additions & 0 deletions jupyter/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ ignore = [
"{{module}}/nbextension/**",
]
[tool.coverage.run]
branch = true
omit = [
"{{module}}/tests/integration/",
]
[tool.coverage.report]
exclude_also = [
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
ignore_errors = true
fail_under = 50
[tool.hatch.build]
artifacts = [
"{{module}}/nbextension",
Expand Down Expand Up @@ -139,6 +153,7 @@ build_cmd = "build"
npm = "pnpm"
[tool.pytest.ini_options]
addopts = ["-vvv", "--junitxml=junit.xml"]
asyncio_mode = "strict"
testpaths = "{{module}}/tests"
Expand Down
4 changes: 2 additions & 2 deletions rust/Makefile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ annotate: ## run python type annotation checks with mypy
#########
.PHONY: test-py tests-py coverage-py
test-py: ## run python tests
python -m pytest -v {{module}}/tests --junitxml=junit.xml
python -m pytest -v {{module}}/tests

# alias
tests-py: test-py

coverage-py: ## run python tests and collect test coverage
python -m pytest -v {{module}}/tests --junitxml=junit.xml --cov={{module}} --cov-branch --cov-fail-under=50 --cov-report term-missing --cov-report xml
python -m pytest -v {{module}}/tests --cov={{module}} --cov-report term-missing --cov-report xml

.PHONY: test-rust tests-rust coverage-rust
test-rust: ## run rust tests
Expand Down
15 changes: 15 additions & 0 deletions rust/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,22 @@ archs = "x86_64 arm64"
environment = {PATH="$UserProfile\\.cargo\bin;$PATH"}
archs = "AMD64 x86"
[tool.coverage.run]
branch = true
omit = [
"{{module}}/tests/integration/",
]
[tool.coverage.report]
exclude_also = [
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
ignore_errors = true
fail_under = 50
[tool.pytest.ini_options]
addopts = ["-vvv", "--junitxml=junit.xml"]
asyncio_mode = "strict"
testpaths = "{{module}}/tests"
Expand Down

0 comments on commit 9f344c2

Please sign in to comment.