Skip to content

Commit ecaed3a

Browse files
committed
sync noxfile
1 parent 09c8b1f commit ecaed3a

File tree

1 file changed

+18
-39
lines changed

1 file changed

+18
-39
lines changed

packages/google-api-core/noxfile.py

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
from __future__ import absolute_import
1616
import os
1717
import pathlib
18-
import pytest
1918
import re
2019
import shutil
2120
import unittest
2221

2322
# https://github.com/google/importlab/issues/25
24-
import nox # pytype: disable=import-error
23+
import nox
2524

2625

2726
BLACK_VERSION = "black==23.7.0"
@@ -33,25 +32,6 @@
3332

3433
DEFAULT_PYTHON_VERSION = "3.14"
3534
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
36-
UNIT_TEST_STANDARD_DEPENDENCIES = [
37-
"mock",
38-
"asyncmock",
39-
"pytest",
40-
"pytest-cov",
41-
"pytest-asyncio",
42-
"pytest-mock",
43-
]
44-
45-
# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
46-
nox.options.sessions = [
47-
"unit",
48-
"prerelease_deps",
49-
"cover",
50-
"lint",
51-
"lint_setup_py",
52-
"blacken",
53-
"docs",
54-
]
5535

5636
# Error if a python version is missing
5737
nox.options.error_on_missing_interpreters = True
@@ -74,20 +54,6 @@ def lint(session):
7454
)
7555
session.run("flake8", "google", "tests")
7656

77-
"""Run type-checking."""
78-
session.install(".[grpc]", "pytype")
79-
session.run("pytype")
80-
81-
session.install(".[grpc,async_rest]", "mypy")
82-
session.install(
83-
"types-setuptools",
84-
"types-requests",
85-
"types-protobuf",
86-
"types-dataclasses",
87-
"types-mock; python_version=='3.7'",
88-
)
89-
session.run("mypy", "google", "tests")
90-
9157

9258
@nox.session(python=DEFAULT_PYTHON_VERSION)
9359
def blacken(session):
@@ -232,16 +198,16 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
232198
session.run(*pytest_args)
233199

234200

235-
@pytest.mark.parametrize(
236-
"install_grpc_gcp,install_grpc,install_async_rest",
201+
@nox.session(python=PYTHON_VERSIONS)
202+
@nox.parametrize(
203+
["install_grpc_gcp", "install_grpc", "install_async_rest"],
237204
[
238205
(False, True, False), # Run unit tests with grpcio installed
239206
(True, True, False), # Run unit tests with grpcio/grpcio-gcp installed
240207
(False, False, False), # Run unit tests without grpcio installed
241208
(False, True, True), # Run unit tests with grpcio and async rest installed
242209
],
243210
)
244-
@nox.session(python=PYTHON_VERSIONS)
245211
def unit(session, install_grpc_gcp, install_grpc, install_async_rest):
246212
"""Run the unit test suite."""
247213

@@ -264,7 +230,7 @@ def unit(session, install_grpc_gcp, install_grpc, install_async_rest):
264230
)
265231

266232

267-
@nox.session(python=PYTHON_VERSIONS)
233+
@nox.session(python=DEFAULT_PYTHON_VERSION)
268234
def prerelease_deps(session):
269235
"""Run the unit test suite."""
270236
default(session, prerelease=True)
@@ -278,6 +244,19 @@ def lint_setup_py(session):
278244
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
279245

280246

247+
@nox.session(python=DEFAULT_PYTHON_VERSION)
248+
def mypy(session):
249+
"""Run type-checking."""
250+
session.install(".[grpc,async_rest]", "mypy")
251+
session.install(
252+
"types-setuptools",
253+
"types-requests",
254+
"types-protobuf",
255+
"types-dataclasses",
256+
)
257+
session.run("mypy", "google", "tests")
258+
259+
281260
@nox.session(python=DEFAULT_PYTHON_VERSION)
282261
def cover(session):
283262
"""Run the final coverage report.

0 commit comments

Comments
 (0)