Skip to content

Commit 7f8d235

Browse files
committed
chore(tests): apply blacken/ruff formatting to modified noxfiles
1 parent a010e5b commit 7f8d235

8 files changed

Lines changed: 62 additions & 35 deletions

File tree

packages/django-google-spanner/noxfile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
)
7979

8080

81-
8281
@nox.session(python=DEFAULT_PYTHON_VERSION)
8382
def lint(session):
8483
"""Run linters.

packages/gapic-generator/noxfile.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,7 @@ def mypy(session):
726726
"click==8.1.3",
727727
)
728728
session.install(".")
729-
session.run(
730-
"mypy",
731-
f"--config-file={MYPY_CONFIG_FILE}", "-p", "gapic")
729+
session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "-p", "gapic")
732730

733731

734732
@nox.session(python=NEWEST_PYTHON)
@@ -740,7 +738,7 @@ def lint(session):
740738
"""
741739

742740
# TODO(https://github.com/googleapis/google-cloud-python/issues/16186):
743-
# SKIP: This session was not enforced in the standalone (split) repo
741+
# SKIP: This session was not enforced in the standalone (split) repo
744742
# and is disabled here to ensure a "move-only" migration.
745743
session.skip(
746744
"Linting was not enforced in the split repo. "
@@ -770,9 +768,11 @@ def lint(session):
770768
@nox.session(python=NEWEST_PYTHON)
771769
def lint_setup_py(session):
772770
# TODO(https://github.com/googleapis/google-cloud-python/issues/16186):
773-
# SKIP: This session was not enforced in the standalone (split) repo
771+
# SKIP: This session was not enforced in the standalone (split) repo
774772
# and is disabled here to ensure a "move-only" migration.
775-
session.skip("Skipping now to avoid changing code during migration. See Issue #16186")
773+
session.skip(
774+
"Skipping now to avoid changing code during migration. See Issue #16186"
775+
)
776776

777777

778778
@nox.session(python="3.10")
@@ -847,9 +847,11 @@ def prerelease_deps(session, protobuf_implementation):
847847
"""
848848
Run all tests with pre-release versions of dependencies installed.
849849
"""
850-
# TODO(https://github.com/googleapis/google-cloud-python/issues/16184):
850+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16184):
851851
# Implement pre-release dependency logic to test against upcoming runtime changes.
852-
session.skip("prerelease_deps session is not yet implemented for gapic-generator-python.")
852+
session.skip(
853+
"prerelease_deps session is not yet implemented for gapic-generator-python."
854+
)
853855

854856

855857
@nox.session(python=NEWEST_PYTHON)
@@ -859,6 +861,8 @@ def prerelease_deps(session, protobuf_implementation):
859861
)
860862
def core_deps_from_source(session, protobuf_implementation):
861863
"""Run all tests with core dependencies installed from source."""
862-
# TODO(https://github.com/googleapis/google-cloud-python/issues/16185):
864+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16185):
863865
# Implement logic to install core packages directly from the mono-repo directories.
864-
session.skip("core_deps_from_source session is not yet implemented for gapic-generator-python.")
866+
session.skip(
867+
"core_deps_from_source session is not yet implemented for gapic-generator-python."
868+
)

packages/google-api-core/noxfile.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
)
5252

5353

54-
5554
# Error if a python version is missing
5655
nox.options.error_on_missing_interpreters = True
5756

@@ -381,9 +380,7 @@ def mypy(session):
381380
"types-requests",
382381
"types-protobuf",
383382
)
384-
session.run(
385-
"mypy",
386-
f"--config-file={MYPY_CONFIG_FILE}", "google", "tests")
383+
session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "google", "tests")
387384

388385

389386
@nox.session(python=DEFAULT_PYTHON_VERSION)

packages/google-cloud-bigquery/noxfile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,12 @@ def mypy(session):
227227
session.run("python", "-m", "pip", "freeze")
228228
with log_package_context(session):
229229
session.run(
230-
"mypy",
231-
f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", "--show-traceback")
230+
"mypy",
231+
f"--config-file={MYPY_CONFIG_FILE}",
232+
"-p",
233+
"google",
234+
"--show-traceback",
235+
)
232236

233237

234238
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)

packages/google-cloud-bigtable/noxfile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ def mypy(session):
186186
"types-requests",
187187
)
188188
session.install("google-cloud-testutils")
189-
session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "-p", "google.cloud.bigtable.data")
189+
session.run(
190+
"mypy", f"--config-file={MYPY_CONFIG_FILE}", "-p", "google.cloud.bigtable.data"
191+
)
190192

191193

192194
@nox.session(python=DEFAULT_PYTHON_VERSION)

packages/google-cloud-testutils/noxfile.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@
4242
# Path to the centralized mypy configuration file at the repository root.
4343
# Search upwards to support running nox from both monorepo packages and integration test goldens.
4444
MYPY_CONFIG_FILE = next(
45-
(str(p / "mypy.ini") for p in CURRENT_DIRECTORY.parents if (p / "mypy.ini").exists()),
45+
(
46+
str(p / "mypy.ini")
47+
for p in CURRENT_DIRECTORY.parents
48+
if (p / "mypy.ini").exists()
49+
),
4650
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
4751
)
4852

4953

50-
5154
@nox.session(python=DEFAULT_PYTHON_VERSION)
5255
def lint(session):
5356
"""Run linters.
@@ -87,8 +90,10 @@ def format(session):
8790

8891
# 2. Run Ruff to fix imports
8992
session.run(
90-
"ruff", "check",
91-
"--select", "I",
93+
"ruff",
94+
"check",
95+
"--select",
96+
"I",
9297
"--fix",
9398
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
9499
"--line-length=88",
@@ -97,7 +102,8 @@ def format(session):
97102

98103
# 3. Run Ruff to format code
99104
session.run(
100-
"ruff", "format",
105+
"ruff",
106+
"format",
101107
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
102108
"--line-length=88",
103109
*BLACK_PATHS,
@@ -120,8 +126,7 @@ def mypy(session):
120126
"types-mock",
121127
"types-setuptools",
122128
)
123-
session.run("mypy",
124-
f"--config-file={MYPY_CONFIG_FILE}", "test_utils/", "tests/")
129+
session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "test_utils/", "tests/")
125130

126131

127132
@nox.session(python=ALL_PYTHON)
@@ -336,14 +341,12 @@ def prerelease_deps(session):
336341
)
337342

338343

339-
340344
@nox.session(python=DEFAULT_PYTHON_VERSION)
341345
def core_deps_from_source(session):
342346
"""Run all tests with core dependencies installed from source
343347
rather than pulling the dependencies from PyPI.
344348
"""
345349

346-
347350
# Install all dependencies
348351
constraints_path = str(
349352
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"

packages/google-resumable-media/noxfile.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
# Path to the centralized mypy configuration file at the repository root.
2525
# Search upwards to support running nox from both monorepo packages and integration test goldens.
2626
MYPY_CONFIG_FILE = next(
27-
(str(p / "mypy.ini") for p in CURRENT_DIRECTORY.parents if (p / "mypy.ini").exists()),
27+
(
28+
str(p / "mypy.ini")
29+
for p in CURRENT_DIRECTORY.parents
30+
if (p / "mypy.ini").exists()
31+
),
2832
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
2933
)
3034

@@ -75,7 +79,7 @@ def unit(session):
7579
line_coverage,
7680
os.path.join("tests", "unit"),
7781
os.path.join("tests_async", "unit"),
78-
*session.posargs
82+
*session.posargs,
7983
)
8084

8185

@@ -113,6 +117,7 @@ def docs(session):
113117
os.path.join("docs", "_build", "html", ""),
114118
)
115119

120+
116121
@nox.session(python="3.10")
117122
def docfx(session):
118123
"""Build the docfx yaml files for this library."""
@@ -258,8 +263,16 @@ def mypy(session):
258263
"types-requests",
259264
"types-mock",
260265
)
261-
session.run("mypy",
262-
f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", "-p", "tests", "-p", "tests_async")
266+
session.run(
267+
"mypy",
268+
f"--config-file={MYPY_CONFIG_FILE}",
269+
"-p",
270+
"google",
271+
"-p",
272+
"tests",
273+
"-p",
274+
"tests_async",
275+
)
263276

264277

265278
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
@@ -327,7 +340,9 @@ def prerelease_deps(session):
327340
# version, the first version we test with in the unit tests sessions has a
328341
# constraints file containing all dependencies and extras.
329342
with open(
330-
CURRENT_DIRECTORY / "testing" / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
343+
CURRENT_DIRECTORY
344+
/ "testing"
345+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
331346
encoding="utf-8",
332347
) as constraints_file:
333348
constraints_text = constraints_file.read()
@@ -408,7 +423,9 @@ def core_deps_from_source(session):
408423
# version, the first version we test with in the unit tests sessions has a
409424
# constraints file containing all dependencies and extras.
410425
with open(
411-
CURRENT_DIRECTORY / "testing" / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
426+
CURRENT_DIRECTORY
427+
/ "testing"
428+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
412429
encoding="utf-8",
413430
) as constraints_file:
414431
constraints_text = constraints_file.read()
@@ -439,7 +456,9 @@ def core_deps_from_source(session):
439456
dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]
440457

441458
session.install(*dep_paths, "--no-deps", "--ignore-installed")
442-
print(f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}")
459+
print(
460+
f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}"
461+
)
443462

444463
other_deps = [
445464
"cryptography",

packages/sqlalchemy-bigquery/noxfile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
)
132132

133133

134-
135134
def _calculate_duration(func):
136135
"""This decorator prints the execution time for the decorated function."""
137136

0 commit comments

Comments
 (0)