99CHANGELOG = ROOT / "CHANGELOG.rst"
1010DOCS = ROOT / "docs"
1111
12- EXTRAS = ["" , "[format]" , "[format-nongpl]" ]
12+ INSTALLABLE = [
13+ nox .param (value , id = name ) for name , value in [
14+ ("no-extras" , ROOT ),
15+ ("format" , f"{ ROOT } [format]" ),
16+ ("format-nongpl" , f"{ ROOT } [format-nongpl]" ),
17+ ]
18+ ]
1319
1420NONGPL_LICENSES = [
1521 "Apache Software License" ,
2127]
2228
2329
24-
2530nox .options .sessions = []
2631
2732
@@ -35,36 +40,45 @@ def _session(fn):
3540
3641
3742@session (python = ["3.8" , "3.9" , "3.10" , "3.11" , "pypy3" ])
38- @nox .parametrize ("extras " , EXTRAS )
39- def tests (session , extras ):
43+ @nox .parametrize ("installable " , INSTALLABLE )
44+ def tests (session , installable ):
4045
4146 env = dict (JSON_SCHEMA_TEST_SUITE = str (ROOT / "json" ))
4247
43- session .install ("virtue" , f"{ ROOT } { extras } " )
48+ session .install ("virtue" , installable )
49+
50+ if session .posargs and session .posargs [0 ] in {"coverage" , "ghcoverage" }:
51+ ghcoverage = session .posargs .pop (0 ) == "ghcoverage"
4452
45- ghcoverage = session .posargs == ["ghcoverage" ]
46- if session .posargs == ["coverage" ] or ghcoverage :
4753 session .install ("coverage[toml]" )
48- session .run ("coverage" , "run" , "-m" , "virtue" , PACKAGE , env = env )
54+ session .run (
55+ "coverage" ,
56+ "run" ,
57+ * session .posargs ,
58+ "-m" ,
59+ "virtue" ,
60+ PACKAGE ,
61+ env = env ,
62+ )
4963 session .run ("coverage" , "report" )
64+
65+ if ghcoverage :
66+ session .run (
67+ "sh" ,
68+ ROOT / ".github/coverage.sh" ,
69+ f"{ session .bin } /python" ,
70+ )
5071 else :
5172 session .run ("virtue" , * session .posargs , PACKAGE , env = env )
5273
53- if ghcoverage :
54- session .run (
55- "sh" ,
56- ROOT / ".github/coverage.sh" ,
57- f"{ session .bin } /python" ,
58- )
59-
6074
6175@session ()
62- @nox .parametrize ("extras " , EXTRAS )
63- def audit (session , extras ):
64- session .install ("pip-audit" , f" { ROOT } { extras } " )
76+ @nox .parametrize ("installable " , INSTALLABLE )
77+ def audit (session , installable ):
78+ session .install ("pip-audit" , installable )
6579 session .run ("python" , "-m" , "pip_audit" )
6680
67- if "nongpl" in extras :
81+ if "format- nongpl" in installable :
6882 session .install ("pip-licenses" )
6983 session .run (
7084 "python" ,
0 commit comments