Skip to content

tests: fix compatibility with pytest 9.1.0#17465

Merged
parthea merged 2 commits into
mainfrom
fix-google-api-core-tests
Jun 15, 2026
Merged

tests: fix compatibility with pytest 9.1.0#17465
parthea merged 2 commits into
mainfrom
fix-google-api-core-tests

Conversation

@parthea

@parthea parthea commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a compatibility issue with pytest==9.1.0. See https://docs.pytest.org/en/stable/deprecations.html#non-collection-iterables-in-pytest-mark-parametrize

See the stack trace below which appears without the fix

________________________________________________________________________________________________________ ERROR collecting tests/unit/test_python_version_support.py ________________________________________________________________________________________________________
.nox/97a4db2a/lib/python3.14/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/97a4db2a/lib/python3.14/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/97a4db2a/lib/python3.14/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper
    return result.get_result()
           ^^^^^^^^^^^^^^^^^^^
.nox/97a4db2a/lib/python3.14/site-packages/pytest_asyncio/plugin.py:701: in pytest_pycollect_makeitem_convert_async_functions_to_subclass
    ) = hook_result.get_result()
        ^^^^^^^^^^^^^^^^^^^^^^^^
.nox/97a4db2a/lib/python3.14/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper
    res = yield
          ^^^^^
.nox/97a4db2a/lib/python3.14/site-packages/_pytest/python.py:250: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/97a4db2a/lib/python3.14/site-packages/_pytest/python.py:476: in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
.nox/97a4db2a/lib/python3.14/site-packages/pluggy/_hooks.py:573: in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/97a4db2a/lib/python3.14/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/97a4db2a/lib/python3.14/site-packages/_pytest/python.py:124: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker)
.nox/97a4db2a/lib/python3.14/site-packages/_pytest/python.py:1316: in parametrize
    argnames, parametersets = ParameterSet._for_parametrize(
.nox/97a4db2a/lib/python3.14/site-packages/_pytest/mark/structures.py:203: in _for_parametrize
    warnings.warn(
E   pytest.PytestRemovedIn10Warning: Passing a non-Collection iterable to parametrize is deprecated.
E   Test: tests/unit/test_python_version_support.py::test_all_tracked_versions_and_date_scenarios, argvalues type: generator
E   Please convert to a list or tuple.
E   See https://docs.pytest.org/en/stable/deprecations.html#parametrize-iterators

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the generate_tracked_version_test_cases function in test_python_version_support.py to return a list of test parameters instead of yielding them. The review comments correctly point out that several added inline comments are redundant and should be removed to comply with PEP 8 guidelines.

Comment thread packages/google-api-core/tests/unit/test_python_version_support.py Outdated
Comment thread packages/google-api-core/tests/unit/test_python_version_support.py Outdated
@parthea parthea force-pushed the fix-google-api-core-tests branch from 2a1c5d0 to 40aefba Compare June 15, 2026 17:52
@parthea parthea marked this pull request as ready for review June 15, 2026 17:53
@parthea parthea requested a review from a team as a code owner June 15, 2026 17:53
@parthea parthea force-pushed the fix-google-api-core-tests branch from 40aefba to ec20478 Compare June 15, 2026 17:54

@chalmerlowe chalmerlowe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one NIT.

Comment thread packages/google-api-core/tests/unit/test_python_version_support.py Outdated
@parthea parthea enabled auto-merge (squash) June 15, 2026 18:22
@parthea parthea merged commit f4945bd into main Jun 15, 2026
32 checks passed
@parthea parthea deleted the fix-google-api-core-tests branch June 15, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants