Skip to content

Commit 4952365

Browse files
authored
feat: set specific linting version for tests, min tested or 3.10 (#13432)
A few samples have skipped tests by ignoring testsing all versions, so use a default, or set to earliest python that is tested.
1 parent 620e280 commit 4952365

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

noxfile-template.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ def get_pytest_env_vars() -> dict[str, str]:
9797

9898
INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
9999

100+
# Use the oldest tested Python version for linting (defaults to 3.10)
101+
LINTING_VERSION = "3.10"
102+
if len(TESTED_VERSIONS) > 0:
103+
LINTING_VERSION = TESTED_VERSIONS[0]
104+
100105
# Error if a python version is missing
101106
nox.options.error_on_missing_interpreters = True
102107

@@ -146,7 +151,7 @@ def _determine_local_import_names(start_dir: str) -> list[str]:
146151
]
147152

148153

149-
@nox.session
154+
@nox.session(python=LINTING_VERSION)
150155
def lint(session: nox.sessions.Session) -> None:
151156
if not TEST_CONFIG["enforce_type_hints"]:
152157
session.install("flake8", "flake8-import-order")
@@ -167,7 +172,7 @@ def lint(session: nox.sessions.Session) -> None:
167172
#
168173

169174

170-
@nox.session
175+
@nox.session(python=LINTING_VERSION)
171176
def blacken(session: nox.sessions.Session) -> None:
172177
session.install("black")
173178
python_files = [path for path in os.listdir(".") if path.endswith(".py")]

0 commit comments

Comments
 (0)