Skip to content

Commit df8fba5

Browse files
committed
remove changes from noxfile
1 parent 5835178 commit df8fba5

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

noxfile.py

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -180,36 +180,37 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
180180
session.run("python", "-c", "import grpc; print(grpc.__version__)")
181181
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")
182182

183-
pytest_command = ["python", "-m", "pytest"]
184-
185-
if session.posargs:
186-
pytest_options = list(session.posargs)
187-
else:
188-
pytest_options = [
189-
"--quiet",
190-
"--cov=google.api_core",
191-
"--cov=tests.unit",
192-
"--cov-append",
193-
"--cov-config=.coveragerc",
194-
"--cov-report=",
195-
"--cov-fail-under=0",
196-
"-n=auto",
197-
os.path.join("tests", "unit"),
198-
"--cov=tests.asyncio",
199-
os.path.join("tests", "asyncio"),
200-
]
201-
202-
# Temporarily disable coverage for Python 3.12 due to a missing
203-
# _sqlite3 module in some environments. This is a workaround. The proper
204-
# fix is to reinstall Python 3.12 with SQLite support.
205-
# We only do this when not running specific tests (no posargs).
206-
if session.python == "3.12" and not session.posargs:
207-
pytest_options = [opt for opt in pytest_options if not opt.startswith("--cov")]
208-
pytest_command.extend(["-p", "no:cov"])
183+
pytest_args = [
184+
"python",
185+
"-m",
186+
"pytest",
187+
*(
188+
# Helpful for running a single test or testfile.
189+
session.posargs
190+
or [
191+
"--quiet",
192+
"--cov=google.api_core",
193+
"--cov=tests.unit",
194+
"--cov-append",
195+
"--cov-config=.coveragerc",
196+
"--cov-report=",
197+
"--cov-fail-under=0",
198+
# Running individual tests with parallelism enabled is usually not helpful.
199+
"-n=auto",
200+
os.path.join("tests", "unit"),
201+
]
202+
),
203+
]
209204

210205
session.install("asyncmock", "pytest-asyncio")
211206

212-
session.run(*pytest_command, *pytest_options)
207+
# Having positional arguments means the user wants to run specific tests.
208+
# Best not to add additional tests to that list.
209+
if not session.posargs:
210+
pytest_args.append("--cov=tests.asyncio")
211+
pytest_args.append(os.path.join("tests", "asyncio"))
212+
213+
session.run(*pytest_args)
213214

214215

215216
@nox.session(python=PYTHON_VERSIONS)

0 commit comments

Comments
 (0)