Skip to content

Commit

Permalink
Improve coverage setup
Browse files Browse the repository at this point in the history
  • Loading branch information
medihack committed Sep 2, 2023
1 parent 9d950e8 commit 5c3426f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ filterwarnings = [
]
timeout = 60

[tool.coverage.run]
branch = true
source = "adit"

[tool.coverage.report]
skip_empty = true
show_missing = true

[tool.ruff]
exclude = ["migrations"]
line-length = 100
Expand Down
15 changes: 10 additions & 5 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ def lint(ctx: Context):
@task
def test(
ctx: Context,
path: str = "./adit",
cov: bool = False,
path: str | None = None,
cov: bool | str = False,
html: bool = False,
keyword: str | None = None,
mark: str | None = None,
stdout: bool = False,
Expand All @@ -213,15 +214,19 @@ def test(
"--env DJANGO_SETTINGS_MODULE=adit.settings.test web pytest "
)
if cov:
cmd += "--cov=adit "
cmd += "--cov "
if isinstance(cov, str):
cmd += f"={cov} "
if html:
cmd += "--cov-report=html"
if keyword:
cmd += f"-k {keyword} "
if mark:
cmd += f"-m {mark} "
if stdout:
cmd += "-s "

cmd += path
if path:
cmd += path
run_cmd(ctx, cmd)


Expand Down

0 comments on commit 5c3426f

Please sign in to comment.