Skip to content

chore(deps-dev): bump pytest from 9.0.3 to 9.1.1 - #9095

Merged
seshubaws merged 1 commit into
developfrom
dependabot/pip/develop/pytest-9.1.1
Jul 31, 2026
Merged

seshubaws merged 1 commit into
developfrom
dependabot/pip/develop/pytest-9.1.1

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Bumps pytest from 9.0.3 to 9.1.1.

Release notes

Sourced from pytest's releases.

9.1.1

pytest 9.1.1 (2026-06-19)

Bug fixes

  • #14220: Fixed a logic bug in pytest.RaisesGroup which would might cause it to display incorrect "It matches FooError() which was paired with BarError" messages.
  • #14591: Fixed a regression in pytest 9.1.0 which caused overriding a parametrized fixture with an indirect @​pytest.mark.parametrize to fail with "duplicate parametrization of '<fixture name>'".
  • #14606: Fixed list-item typing errors from mypy in @pytest.mark.parametrize <pytest.mark.parametrize ref> argvalues parameter.
  • #14608: Fixed a regression in pytest 9.1.0 where conftest.py files located in <invocation dir>/test* were no longer loaded as initial conftests when invoked without arguments. This could cause certain hooks (like pytest_addoption) in these files to not fire.

9.1.0

pytest 9.1.0 (2026-06-13)

Removals and backward incompatible breaking changes

  • #14533: When using --doctest-modules, autouse fixtures with module, package or session scope that are defined inline in Python test modules (not plugins or conftests) will now possibly execute twice.

    If this is undesirable, move the fixture definition to a conftest.py file if possible.

    Technical explanation for those interested: When using --doctest-modules, pytest possibly collects Python modules twice, once as pytest.Module and once as a DoctestModule (depending on the configuration). Due to improvements in pytest's fixture implementation, if e.g. the DoctestModule collects a fixture, it is now visible to it only, and not to the Module. This means that both need to register the fixtures independently.

Deprecations (removal in next major release)

  • #10819: Added a deprecation warning for class-scoped fixtures defined as instance methods (without @classmethod). Such fixtures set attributes on a different instance than the test methods use, leading to unexpected behavior. Use @classmethod decorator instead -- by yastcher.

    See 10819 and 14011.

  • #12882: Calling request.getfixturevalue() <pytest.FixtureRequest.getfixturevalue> during teardown to request a fixture that was not already requested is now deprecated and will become an error in pytest 10.

    See dynamic-fixture-request-during-teardown for details.

  • #13409: Using non-~collections.abc.Collection iterables (such as generators, iterators, or custom iterable objects) for the argvalues parameter in @pytest.mark.parametrize <pytest.mark.parametrize ref> and metafunc.parametrize <pytest.Metafunc.parametrize> is now deprecated.

    These iterables get exhausted after the first iteration, leading to tests getting unexpectedly skipped in cases such as running pytest.main() multiple times, using class-level parametrize decorators, or collecting tests multiple times.

    See parametrize-iterators for details and suggestions.

  • #13946: The private config.inicfg attribute is now deprecated. Use config.getini() <pytest.Config.getini> to access configuration values instead.

    See config-inicfg for more details.

  • #14004: Passing baseid to ~pytest.FixtureDef or nodeid strings to fixture registration APIs is now deprecated. These are internal pytest APIs that are used by some plugins.

... (truncated)

Commits
  • cf470ec Prepare release version 9.1.1
  • e0c8ce6 Merge pull request #14625 from pytest-dev/patchback/backports/9.1.x/a07c31a97...
  • 1b82d16 Merge pull request #14624 from pytest-dev/patchback/backports/9.1.x/b375b79ec...
  • 501c4bc Merge pull request #14596 from bluetech/doc-classmethod
  • b61f588 Merge pull request #14622 from chrisburr/fix-14608-initial-conftest-test-subdir
  • 9a567e0 [automated] Update plugin list (#14617) (#14618)
  • ef8b299 Merge pull request #14620 from pytest-dev/patchback/backports/9.1.x/680f9f3ed...
  • 66abd07 Merge pull request #14220 from bysiber/fix-stale-iexp-raisesgroup
  • 79fbf93 Merge pull request #14612 from pytest-dev/patchback/backports/9.1.x/974ed48b6...
  • 0d312eb Merge pull request #14611 from bluetech/parametrize-argvalues-typing
  • Additional commits viewable in compare view

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Jun 22, 2026
@dependabot
dependabot Bot requested a review from a team as a code owner June 22, 2026 08:10
@dependabot dependabot Bot added python Pull requests that update Python code dependencies Pull requests that update a dependency file labels Jun 22, 2026
@valerena

Copy link
Copy Markdown
Contributor

@dependabot rebase

@dependabot
dependabot Bot force-pushed the dependabot/pip/develop/pytest-9.1.1 branch from 7a8aa93 to 7e8d8b2 Compare June 25, 2026 23:12

@roger-zhangg roger-zhangg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

@dependabot
dependabot Bot force-pushed the dependabot/pip/develop/pytest-9.1.1 branch from 7e8d8b2 to 0780bc6 Compare June 29, 2026 23:01
Bumps [pytest](https://github.com/pytest-dev/pytest) from 9.0.3 to 9.1.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@9.0.3...9.1.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.1.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot
dependabot Bot force-pushed the dependabot/pip/develop/pytest-9.1.1 branch from 0780bc6 to 4f846d1 Compare June 29, 2026 23:43
@seshubaws
seshubaws added this pull request to the merge queue Jul 31, 2026
Merged via the queue into develop with commit b5b8871 Jul 31, 2026
54 checks passed
@dependabot
dependabot Bot deleted the dependabot/pip/develop/pytest-9.1.1 branch July 31, 2026 20:30
roger-zhangg added a commit that referenced this pull request Aug 17, 2026
sync-code and sync-watch have failed on every scheduled run since pytest was bumped
9.0.3 -> 9.1.1 (#9095, 2026-07-31). Latest: 37 passed, 52 errors. The last pre-bump run
passed with 89 passed, 1 rerun.

Reproducible in ten lines, no AWS:

    class TestFixt:
        @pytest.fixture(scope="class")
        def fixt(self): yield
        def test_1(self, fixt): pass
        def test_2(self, fixt): pass

  pytest 9.0.3          -> 2 passed
  pytest 9.1.1 -W error -> 2 errors

1. pytest 9.1 deprecated class-scoped fixtures declared as instance methods.
2. `filterwarnings = error` in pytest.ini makes that a setup failure on the first test
   of every affected class.
3. pytest then raises its own internal AssertionError ("assert not self._finalizers",
   fixtures.py:1221) for the remaining tests in the class -- upstream
   pytest-dev/pytest#14775, still open. Root cause is fixtures.py:1147: finish()
   early-returns when cached_result is None without clearing _finalizers.
4. `--reruns 3` reports only the final attempt, so the real warning is discarded and only
   the internal AssertionError survives. That is why the CI logs contain zero occurrences
   of the actual cause. Counts line up: 52 errors x 3 reruns = 156 reruns (sync-watch:
   12 x 3 = 36).

Suppressing is safe here specifically: these fixtures assign to the class
(`TestSyncCodeBase.stack_name = ...`), not to `self`, so the hazard the deprecation warns
about -- attributes set on self being invisible to tests -- does not apply.

Marked on the three classes that declare these fixtures rather than in pytest.ini, so the
rest of the suite still fails on this warning. A class mark rather than a module-level
pytestmark because TestSyncCodeBase is subclassed from other modules
(test_sync_build_in_source.py, test_sync_adl.py) and a module mark would not reach them,
which is why one base class took out both sync-code and sync-watch.

Converting the fixtures is required before pytest 10 and is deliberately not done here:
execute_infra_sync derives its stack name from self._method_to_stack_name(self.id()), and
unittest's id() needs an instance, so it changes live CloudFormation stack names.

Testing: verified against the repo's real pytest.ini that the same parameterized
class-scoped shape goes 6 errors -> 6 passed with the mark, and that an unmarked one still
errors, so suite-wide protection is intact. Confirmed pytest resolves the mark through the
MRO for subclasses that carry their own marks. tests/integration/{sync,logs,traces}
collect 266 tests. black and ruff clean.
roger-zhangg added a commit to madhavdonthula1/aws-sam-cli that referenced this pull request Aug 19, 2026
* tests: unblock nightly sync integ tests on pytest 9.1

sync-code and sync-watch have failed on every scheduled run since pytest was bumped
9.0.3 -> 9.1.1 (aws#9095, 2026-07-31). Latest: 37 passed, 52 errors. The last pre-bump run
passed with 89 passed, 1 rerun.

Reproducible in ten lines, no AWS:

    class TestFixt:
        @pytest.fixture(scope="class")
        def fixt(self): yield
        def test_1(self, fixt): pass
        def test_2(self, fixt): pass

  pytest 9.0.3          -> 2 passed
  pytest 9.1.1 -W error -> 2 errors

1. pytest 9.1 deprecated class-scoped fixtures declared as instance methods.
2. `filterwarnings = error` in pytest.ini makes that a setup failure on the first test
   of every affected class.
3. pytest then raises its own internal AssertionError ("assert not self._finalizers",
   fixtures.py:1221) for the remaining tests in the class -- upstream
   pytest-dev/pytest#14775, still open. Root cause is fixtures.py:1147: finish()
   early-returns when cached_result is None without clearing _finalizers.
4. `--reruns 3` reports only the final attempt, so the real warning is discarded and only
   the internal AssertionError survives. That is why the CI logs contain zero occurrences
   of the actual cause. Counts line up: 52 errors x 3 reruns = 156 reruns (sync-watch:
   12 x 3 = 36).

Suppressing is safe here specifically: these fixtures assign to the class
(`TestSyncCodeBase.stack_name = ...`), not to `self`, so the hazard the deprecation warns
about -- attributes set on self being invisible to tests -- does not apply.

Marked on the three classes that declare these fixtures rather than in pytest.ini, so the
rest of the suite still fails on this warning. A class mark rather than a module-level
pytestmark because TestSyncCodeBase is subclassed from other modules
(test_sync_build_in_source.py, test_sync_adl.py) and a module mark would not reach them,
which is why one base class took out both sync-code and sync-watch.

Converting the fixtures is required before pytest 10 and is deliberately not done here:
execute_infra_sync derives its stack name from self._method_to_stack_name(self.id()), and
unittest's id() needs an instance, so it changes live CloudFormation stack names.

Testing: verified against the repo's real pytest.ini that the same parameterized
class-scoped shape goes 6 errors -> 6 passed with the mark, and that an unmarked one still
errors, so suite-wide protection is intact. Confirmed pytest resolves the mark through the
MRO for subclasses that carry their own marks. tests/integration/{sync,logs,traces}
collect 266 tests. black and ruff clean.

* tests: anchor the pytest 9.1 ignore on the warning category

Review feedback: keying the filter on the message prose means it stops applying if
upstream rewords the warning, and that failure is silent.

Confirmed the failure mode rather than assuming it. `filterwarnings` marks reach
warnings.filterwarnings, where the message becomes re.compile(msg, re.I).match(...), so a
stale phrase simply never matches: with a deliberately reworded pattern the probe goes
back to 4 errors / 8 reruns showing only the bare "assert not self._finalizers", exactly
the opaque failure this change exists to prevent.

Also checked the suggested compromise of combining message and category. It does not
help -- warnings.filterwarnings requires both fields to match, so the combined form is as
brittle as message-only:

  stale message, message only                    -> error
  stale message, message + category              -> error
  stale message, category only                   -> passes

So the filter is now category-only. `pytest.PytestRemovedIn10Warning` is exported by
pytest 9.1.1, and this matches existing convention: test_build_cmd.py:58 uses
"ignore::ResourceWarning" and pytest.ini has six ignore::Category entries.

The tradeoff is that it also suppresses the other eight PytestRemovedIn10Warning messages
in pytest 9.1.1 inside these three classes. That is acceptable: they cover config.inicfg,
pytest.console_main, FixtureDef.has_location, fixture baseid/nodeid, parsefactories
nodeid, monkeypatch.syspath_prepend and --pastebin -- plugin and config level APIs these
integration test classes do not touch.

Testing: unmarked probe still errors (6 errors, 18 rerun) so suite-wide protection is
intact; the category-marked equivalent passes. tests/integration/{sync,logs,traces}
collect 266 tests. black and ruff clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file pr/internal python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants