Skip to content

Commit f3f3a44

Browse files
committed
ignore future warnings
1 parent 9be30b5 commit f3f3a44

File tree

2 files changed

+40
-50
lines changed

2 files changed

+40
-50
lines changed

noxfile.py

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,12 @@ 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-
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-
)
162+
session.install(
163+
"-e",
164+
lib_with_extras,
165+
"-c",
166+
constraints_file,
167+
)
175168

176169
# Print out package versions of dependencies
177170
session.run(
@@ -193,31 +186,32 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
193186
"-m",
194187
"pytest",
195188
]
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",
204-
*(
205-
# Helpful for running a single test or testfile.
206-
session.posargs
207-
or [
208-
"--quiet",
209-
"--cov=google.api_core",
210-
"--cov=tests.unit",
211-
"--cov-append",
212-
"--cov-config=.coveragerc",
213-
"--cov-report=",
214-
"--cov-fail-under=0",
215-
# Running individual tests with parallelism enabled is usually not helpful.
216-
"-n=auto",
217-
os.path.join("tests", "unit"),
218-
]
219-
),
220-
])
189+
pytest_args.extend(["-W", "ignore::FutureWarning"])
190+
191+
pytest_args.extend(
192+
[
193+
# We use filterwarnings to ignore warnings that are out of our control,
194+
# but we want to make sure that our own code does not generate warnings.
195+
"-m",
196+
"not filterwarnings",
197+
*(
198+
# Helpful for running a single test or testfile.
199+
session.posargs
200+
or [
201+
"--quiet",
202+
"--cov=google.api_core",
203+
"--cov=tests.unit",
204+
"--cov-append",
205+
"--cov-config=.coveragerc",
206+
"--cov-report=",
207+
"--cov-fail-under=0",
208+
# Running individual tests with parallelism enabled is usually not helpful.
209+
"-n=auto",
210+
os.path.join("tests", "unit"),
211+
]
212+
),
213+
]
214+
)
221215

222216
session.install("asyncmock", "pytest-asyncio")
223217

tests/unit/test_python_version_support.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,17 @@ def test_override_gapic_end_only():
178178
"google.api_core._python_version_support.PYTHON_VERSION_INFO",
179179
{version_tuple: overridden_info},
180180
):
181-
with pytest.warns(FutureWarning):
182-
result_before_boundary = check_python_version(
183-
today=custom_gapic_end + datetime.timedelta(days=-1)
184-
)
181+
result_before_boundary = check_python_version(
182+
today=custom_gapic_end + datetime.timedelta(days=-1)
183+
)
185184
assert result_before_boundary == PythonVersionStatus.PYTHON_VERSION_EOL
186185

187-
with pytest.warns(FutureWarning):
188-
result_at_boundary = check_python_version(today=custom_gapic_end)
186+
result_at_boundary = check_python_version(today=custom_gapic_end)
189187
assert result_at_boundary == PythonVersionStatus.PYTHON_VERSION_EOL
190188

191-
with pytest.warns(FutureWarning):
192-
result_after_boundary = check_python_version(
193-
today=custom_gapic_end + datetime.timedelta(days=1)
194-
)
189+
result_after_boundary = check_python_version(
190+
today=custom_gapic_end + datetime.timedelta(days=1)
191+
)
195192
assert (
196193
result_after_boundary == PythonVersionStatus.PYTHON_VERSION_UNSUPPORTED
197194
)
@@ -220,8 +217,7 @@ def test_override_gapic_deprecation_only():
220217
result_before_boundary == PythonVersionStatus.PYTHON_VERSION_SUPPORTED
221218
)
222219

223-
with pytest.warns(FutureWarning):
224-
result_at_boundary = check_python_version(today=custom_gapic_dep)
220+
result_at_boundary = check_python_version(today=custom_gapic_dep)
225221
assert result_at_boundary == PythonVersionStatus.PYTHON_VERSION_DEPRECATED
226222

227223

0 commit comments

Comments
 (0)