Skip to content

Commit 9be30b5

Browse files
committed
fix warnings for wo_grpc nox session
1 parent 73e722b commit 9be30b5

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

noxfile.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,19 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
159159
if not pathlib.Path(constraints_file).exists():
160160
constraints_file = f"{constraints_dir}/constraints-{session.python}.txt"
161161

162-
session.install(
163-
"-e",
164-
lib_with_extras,
165-
"-c",
166-
constraints_file,
167-
)
162+
if not install_grpc and not install_async_rest:
163+
session.install(
164+
"google-api-core",
165+
"-c",
166+
constraints_file,
167+
)
168+
else:
169+
session.install(
170+
"-e",
171+
lib_with_extras,
172+
"-c",
173+
constraints_file,
174+
)
168175

169176
# Print out package versions of dependencies
170177
session.run(
@@ -185,6 +192,15 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
185192
"python",
186193
"-m",
187194
"pytest",
195+
]
196+
if not install_grpc and not install_async_rest:
197+
pytest_args.extend(["-W", "ignore::FutureWarning"])
198+
199+
pytest_args.extend([
200+
# We use filterwarnings to ignore warnings that are out of our control,
201+
# but we want to make sure that our own code does not generate warnings.
202+
"-m",
203+
"not filterwarnings",
188204
*(
189205
# Helpful for running a single test or testfile.
190206
session.posargs
@@ -201,7 +217,7 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
201217
os.path.join("tests", "unit"),
202218
]
203219
),
204-
]
220+
])
205221

206222
session.install("asyncmock", "pytest-asyncio")
207223

0 commit comments

Comments
 (0)