Skip to content

Commit b16e90d

Browse files
committed
chore: updates to noxfile sessions, versions and creds check.
1 parent 35db0fe commit b16e90d

1 file changed

Lines changed: 59 additions & 5 deletions

File tree

packages/django-google-spanner/noxfile.py

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import nox
1717

1818
BLACK_VERSION = "black==22.3.0"
19+
ISORT_VERSION = "isort==5.11.0"
1920
BLACK_PATHS = [
2021
"docs",
2122
"django_spanner",
@@ -25,9 +26,21 @@
2526
]
2627

2728
MOCKSERVER_TEST_PYTHON_VERSION = "3.12"
28-
DEFAULT_PYTHON_VERSION = "3.8"
29-
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
30-
UNIT_TEST_PYTHON_VERSIONS = ["3.8", "3.9", "3.10"]
29+
DEFAULT_PYTHON_VERSION = "3.14"
30+
31+
UNIT_TEST_PYTHON_VERSIONS = [
32+
"3.8",
33+
"3.9",
34+
"3.10",
35+
"3.11",
36+
"3.12",
37+
"3.13",
38+
"3.14",
39+
]
40+
ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS)
41+
ALL_PYTHON.extend(["3.7"])
42+
43+
SYSTEM_TEST_PYTHON_VERSIONS = ALL_PYTHON
3144

3245
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
3346

@@ -61,7 +74,7 @@ def blacken(session):
6174
@nox.session(python=DEFAULT_PYTHON_VERSION)
6275
def lint_setup_py(session):
6376
"""Verify that setup.py is valid (including RST check)."""
64-
session.install("docutils", "pygments")
77+
session.install("docutils", "pygments", "setuptools")
6578
session.run(
6679
"python", "setup.py", "check", "--restructuredtext", "--strict"
6780
)
@@ -100,7 +113,7 @@ def default(session, django_version="3.2"):
100113
)
101114

102115

103-
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
116+
@nox.session(python=ALL_PYTHON)
104117
def unit(session):
105118
"""Run the unit test suite."""
106119
if session.python in ("3.7",):
@@ -288,3 +301,44 @@ def docfx(session):
288301
os.path.join("docs", ""),
289302
os.path.join("docs", "_build", "html", ""),
290303
)
304+
305+
306+
@nox.session(python=DEFAULT_PYTHON_VERSION)
307+
def mypy(session):
308+
"""Run the type checker."""
309+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
310+
# Add mypy tests
311+
session.skip("mypy tests are not yet supported")
312+
313+
314+
@nox.session(python=DEFAULT_PYTHON_VERSION)
315+
def core_deps_from_source(session):
316+
"""Run all tests with core dependencies installed from source
317+
rather than pulling the dependencies from PyPI.
318+
"""
319+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
320+
# Add core deps from source tests
321+
session.skip("Core deps from source tests are not yet supported")
322+
323+
324+
@nox.session(python=DEFAULT_PYTHON_VERSION)
325+
def prerelease_deps(session):
326+
"""Run all tests with prerelease versions of dependencies installed."""
327+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
328+
# Add prerelease deps tests
329+
session.skip("prerelease deps tests are not yet supported")
330+
331+
332+
@nox.session
333+
def format(session: nox.sessions.Session) -> None:
334+
"""
335+
Run isort to sort imports. Then run black
336+
to format code to uniform standard.
337+
"""
338+
session.install(BLACK_VERSION, ISORT_VERSION)
339+
python_files = [path for path in os.listdir(".") if path.endswith(".py")]
340+
341+
# Use the --fss option to sort imports using strict alphabetical order.
342+
# See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
343+
session.run("isort", "--fss", *python_files)
344+
session.run("black", *python_files)

0 commit comments

Comments
 (0)