Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 51b5d69

Browse files
chore: Clean up nox test dependency installs
1 parent 248c8ea commit 51b5d69

File tree

1 file changed

+19
-31
lines changed

1 file changed

+19
-31
lines changed

noxfile.py

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,8 @@
6767
UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
6868
UNIT_TEST_STANDARD_DEPENDENCIES = [
6969
"mock",
70-
"asyncmock",
7170
PYTEST_VERSION,
72-
"pytest-asyncio",
7371
"pytest-cov",
74-
"pytest-mock",
7572
"pytest-timeout",
7673
]
7774
UNIT_TEST_LOCAL_DEPENDENCIES: List[str] = []
@@ -106,8 +103,6 @@
106103
SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [
107104
"google-cloud-bigquery",
108105
]
109-
SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = []
110-
SYSTEM_TEST_DEPENDENCIES: List[str] = []
111106
SYSTEM_TEST_EXTRAS: List[str] = ["tests"]
112107
SYSTEM_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {
113108
# Make sure we leave some versions without "extras" so we know those
@@ -206,20 +201,20 @@ def lint_setup_py(session):
206201

207202

208203
def install_unittest_dependencies(session, install_test_extra, *constraints):
209-
standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
210-
session.install(*standard_deps, *constraints)
204+
args = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
211205

212206
if UNIT_TEST_LOCAL_DEPENDENCIES:
213-
session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints)
207+
args += UNIT_TEST_LOCAL_DEPENDENCIES
214208

215209
if install_test_extra:
210+
extras = []
216211
if session.python in UNIT_TEST_EXTRAS_BY_PYTHON:
217212
extras = UNIT_TEST_EXTRAS_BY_PYTHON[session.python]
218213
else:
219214
extras = UNIT_TEST_EXTRAS
220-
session.install("-e", f".[{','.join(extras)}]", *constraints)
221-
else:
222-
session.install("-e", ".", *constraints)
215+
args += "-e", f".[{','.join(extras)}]"
216+
217+
session.install(*args, *constraints)
223218

224219

225220
def run_unit(session, install_test_extra):
@@ -308,33 +303,26 @@ def mypy(session):
308303

309304

310305
def install_systemtest_dependencies(session, install_test_extra, *constraints):
311-
# Use pre-release gRPC for system tests.
312-
# Exclude version 1.49.0rc1 which has a known issue.
313-
# See https://github.com/grpc/grpc/pull/30642
314-
session.install("--pre", "grpcio!=1.49.0rc1")
315-
316-
session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints)
317-
318-
if SYSTEM_TEST_EXTERNAL_DEPENDENCIES:
319-
session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints)
320-
321-
if SYSTEM_TEST_LOCAL_DEPENDENCIES:
322-
session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints)
323-
324-
if SYSTEM_TEST_DEPENDENCIES:
325-
session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints)
326-
327306
if install_test_extra and SYSTEM_TEST_EXTRAS_BY_PYTHON:
328307
extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, [])
329308
elif install_test_extra and SYSTEM_TEST_EXTRAS:
330309
extras = SYSTEM_TEST_EXTRAS
331310
else:
332311
extras = []
333312

334-
if extras:
335-
session.install("-e", f".[{','.join(extras)}]", *constraints)
336-
else:
337-
session.install("-e", ".", *constraints)
313+
# Use pre-release gRPC for system tests.
314+
# Exclude version 1.49.0rc1 which has a known issue.
315+
# See https://github.com/grpc/grpc/pull/30642
316+
317+
session.install(
318+
"--pre",
319+
"grpcio!=1.49.0rc1",
320+
*SYSTEM_TEST_STANDARD_DEPENDENCIES,
321+
*SYSTEM_TEST_EXTERNAL_DEPENDENCIES,
322+
"-e",
323+
f".[{','.join(extras)}]" if extras else ".",
324+
*constraints,
325+
)
338326

339327

340328
def run_system(

0 commit comments

Comments
 (0)