Skip to content

Commit ae4eb89

Browse files
committed
extract common sync args
1 parent ab9fc4d commit ae4eb89

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

noxfile.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,14 @@
5252
("black", LINT_PATH, TESTS_PATH),
5353
]
5454

55+
# Default args for all uv sync calls
56+
SYNC_ARGS = ["--frozen", "--quiet"]
57+
5558

5659
@nox.session(name="dev", python=False)
5760
def dev_session(session: nox.Session) -> None:
5861
"""Create a development environment."""
59-
session.run_install("uv", "sync", "--frozen", "--quiet")
62+
session.run_install("uv", "sync", *SYNC_ARGS)
6063

6164

6265
@nox.session(name="test", python=False)
@@ -68,7 +71,7 @@ def run_tests_with_coverage(session: nox.Session) -> None:
6871
session.posargs.remove("no-config")
6972
extra = ["--no-config"]
7073

71-
session.run_install("uv", "sync", "--frozen", "--quiet", "--group", "test", *extra)
74+
session.run_install("uv", "sync", "--group", "test", *SYNC_ARGS, *extra)
7275

7376
coverage = functools.partial(session.run, "uv", "run", *extra, "coverage")
7477

@@ -86,7 +89,7 @@ def run_tests_with_coverage(session: nox.Session) -> None:
8689
@nox.session(name="combine", python=False)
8790
def combine_coverage(session: nox.Session) -> None:
8891
"""Combine parallel-mode coverage files and produce reports."""
89-
session.run_install("uv", "sync", "--frozen", "--quiet", "--group", "test")
92+
session.run_install("uv", "sync", "--group", "test", *SYNC_ARGS)
9093

9194
coverage = functools.partial(session.run, "uv", "run", "coverage")
9295

@@ -99,7 +102,7 @@ def combine_coverage(session: nox.Session) -> None:
99102
@nox.session(name="lint", python=False)
100103
def run_linters(session: nox.Session) -> None:
101104
"""Run code linters, and type checking against all files."""
102-
session.run_install("uv", "sync", "--frozen", "--quiet", "--group", "test", "--group", "lint")
105+
session.run_install("uv", "sync", "--group", "test", "--group", "lint", *SYNC_ARGS)
103106

104107
for linter_args in LINTERS:
105108
session.run("uv", "run", *linter_args)
@@ -108,7 +111,7 @@ def run_linters(session: nox.Session) -> None:
108111
@nox.session(name="format", python=False)
109112
def run_formatters(session: nox.Session) -> None:
110113
"""Run code formatters against all files."""
111-
session.run_install("uv", "sync", "--frozen", "--quiet", "--group", "format")
114+
session.run_install("uv", "sync", "--group", "format", *SYNC_ARGS)
112115

113116
for formatter_args in FORMATTERS:
114117
session.run("uv", "run", *formatter_args)

0 commit comments

Comments
 (0)