@@ -13,12 +13,36 @@ def test(ctx: Context, args: str = ""):
1313 ctx .run (f"pytest { args } " , pty = use_pty )
1414
1515
16+ @task (optional = ["args" ], help = {"args" : "pytest additional arguments" })
17+ def test_unit (ctx : Context , args : str = "" ):
18+ """run unit tests (without coverage)"""
19+ ctx .run (f"pytest tests/unit { args } " , pty = use_pty )
20+
21+
22+ @task (optional = ["args" ], help = {"args" : "pytest additional arguments" })
23+ def test_integration (ctx : Context , args : str = "" ):
24+ """run integration tests (without coverage)"""
25+ ctx .run (f"pytest tests/integration { args } " , pty = use_pty )
26+
27+
1628@task (optional = ["args" ], help = {"args" : "pytest additional arguments" })
1729def test_cov (ctx : Context , args : str = "" ):
1830 """run test vith coverage"""
1931 ctx .run (f"coverage run -m pytest { args } " , pty = use_pty )
2032
2133
34+ @task (optional = ["args" ], help = {"args" : "pytest additional arguments" })
35+ def test_unit_cov (ctx : Context , args : str = "" ):
36+ """run test vith coverage"""
37+ ctx .run (f"coverage run -m pytest tests/unit { args } " , pty = use_pty )
38+
39+
40+ @task (optional = ["args" ], help = {"args" : "pytest additional arguments" })
41+ def test_integration_cov (ctx : Context , args : str = "" ):
42+ """run test vith coverage"""
43+ ctx .run (f"coverage run -m pytest tests/integration { args } " , pty = use_pty )
44+
45+
2246@task (optional = ["html" ], help = {"html" : "flag to export html report" })
2347def report_cov (ctx : Context , * , html : bool = False ):
2448 """report coverage"""
@@ -42,6 +66,19 @@ def coverage(ctx: Context, args: str = "", *, html: bool = False):
4266 report_cov (ctx , html = html )
4367
4468
69+ @task (
70+ optional = ["args" , "html" ],
71+ help = {
72+ "args" : "pytest additional arguments" ,
73+ "html" : "flag to export html report" ,
74+ },
75+ )
76+ def coverage_unit (ctx : Context , args : str = "" , * , html : bool = False ):
77+ """run unit tests and report coverage"""
78+ test_unit_cov (ctx , args = args )
79+ report_cov (ctx , html = html )
80+
81+
4582@task (optional = ["args" ], help = {"args" : "black additional arguments" })
4683def lint_black (ctx : Context , args : str = "." ):
4784 args = args or "." # needed for hatch script
0 commit comments