The PyTest team has officially released PyTest 9.1.0, introducing several fixture-related changes, deprecations, and behavioral updates that could directly affect existing automation frameworks.
Unlike some maintenance releases that primarily contain bug fixes, PyTest 9.1.0 includes changes that can impact how fixtures execute and how test suites behave after upgrading.
For QA Engineers, SDETs, Automation Architects, and teams maintaining large Python test frameworks, understanding these changes before upgrading is essential.
What Is PyTest 9.1.0?
PyTest remains one of the most widely used Python testing frameworks and is heavily adopted across:
- Test Automation
- API Testing
- Playwright Python Frameworks
- Selenium Automation
- Backend Testing
- Unit Testing
- Integration Testing
- AI Testing Frameworks
Official Release Notes:
https://github.com/pytest-dev/pytest/releases/tag/9.1.0
Official Documentation:
Official Repository:
https://github.com/pytest-dev/pytest
Why PyTest 9.1.0 Matters for QA Engineers
Many organizations depend on:
- Shared fixtures
- Session-scoped fixtures
- Module-scoped fixtures
- Custom framework architecture
- Large regression suites
Even small fixture behavior changes can lead to:
- Test instability
- Unexpected executions
- Duplicate setup actions
- Environment contamination
- CI/CD failures
This is why PyTest 9.1.0 deserves careful evaluation.
Biggest Change in PyTest 9.1.0: Fixture Execution with Doctests
The most significant backward compatibility change affects:
pytest --doctest-modules
When using doctest modules, PyTest may now execute certain autouse fixtures twice.
Affected fixture scopes include:
- module
- package
- session
if they are defined directly inside Python test modules.
Why This Happens
PyTest can collect modules twice:
- As a standard PyTest module
- As a DoctestModule
Following fixture visibility improvements, both collectors may independently register fixtures.
As a result:
- Setup code may execute twice
- Initialization may occur twice
- Environment preparation may run twice
This can create unexpected side effects.
QA Risks
Potential issues include:
Duplicate Test Data Creation
@pytest.fixture(scope="module", autouse=True)
def setup_test_data():
create_user()
The fixture may execute twice.
Result:
- Duplicate records
- Data conflicts
- Test instability
External Service Calls
Fixtures that:
- Create environments
- Provision resources
- Initialize cloud services
could trigger duplicate operations.
This may increase:
- Execution costs
- Runtime duration
- Infrastructure usage
Environment Contamination
Teams using shared environments should validate:
- Test setup
- Cleanup operations
- Resource allocation
after upgrading.
Recommended Migration Strategy
The PyTest team recommends moving affected fixtures into:
conftest.py
instead of defining them directly inside test modules.
Recommended Structure
# conftest.py
import pytest
@pytest.fixture(scope="module", autouse=True)
def setup_environment():
pass
This is now considered the safest approach.
New Deprecation: Class-Scoped Fixtures as Instance Methods
PyTest 9.1.0 introduces a new deprecation warning for:
class TestExample:
@pytest.fixture(scope="class")
def setup(self):
pass
Why This Is Being Deprecated
PyTest discovered that:
- Fixture execution instance
- Test execution instance
may not be the same object.
This can create subtle bugs.
Example:
self.value = "test"
set inside the fixture may not be available inside tests.
Recommended Fix
Use:
@classmethod
for class-scoped fixtures.
Example:
class TestExample:
@classmethod
@pytest.fixture(scope="class")
def setup(cls):
pass
This aligns with future PyTest expectations.
Deprecation: request.getfixturevalue() During Teardown
Another important deprecation targets:
request.getfixturevalue()
during fixture teardown.
Why This Matters
Many advanced frameworks dynamically load fixtures during cleanup phases.
Future PyTest releases may remove this behavior entirely.
Framework Owners Should Audit
Search your automation framework for:
request.getfixturevalue(
and review any teardown implementations.
This is particularly important for:
- Enterprise frameworks
- Shared automation libraries
- Internal testing platforms
What PyTest 9.1.0 Means for Playwright Users
Many Playwright Python projects rely on:
- Session fixtures
- Browser fixtures
- Context fixtures
- Authentication fixtures
Teams should validate:
- Browser initialization
- Storage state setup
- Authentication workflows
- Environment provisioning
especially if doctests are enabled.
What PyTest 9.1.0 Means for Selenium Frameworks
Selenium frameworks frequently use:
- Driver fixtures
- Environment fixtures
- Reporting fixtures
Verify:
- WebDriver creation
- Cleanup routines
- Reporting integrations
after upgrading.
Impact on AI Testing Frameworks
Organizations testing:
- LLM applications
- Agentic AI systems
- RAG pipelines
often rely heavily on session-scoped fixtures.
Examples:
- Vector database initialization
- Test dataset loading
- Agent bootstrapping
Review fixture placement carefully.
PyTest 9.1.0 vs PyTest 9.0
| Area | PyTest 9.0 | PyTest 9.1.0 |
|---|---|---|
| Doctest Fixture Behavior | Previous Behavior | Updated |
| Fixture Visibility | Standard | Improved |
| Class Fixture Validation | Existing | Deprecation Added |
| Teardown Fixture Access | Allowed | Deprecated |
| Framework Compatibility | Stable | Requires Review |
Testing Checklist After Upgrading
Fixture Validation
✅ Session fixtures
✅ Module fixtures
✅ Package fixtures
✅ Autouse fixtures
Doctest Validation
✅ –doctest-modules
✅ Shared fixtures
✅ Resource creation
Framework Validation
✅ Playwright
✅ Selenium
✅ API testing frameworks
CI/CD Validation
✅ GitHub Actions
✅ Jenkins
✅ Azure DevOps
✅ GitLab Pipelines
Upgrade Guide
Upgrade PyTest
pip install --upgrade pytest
Verify Version
pytest --version
Run Deprecation Checks
pytest -Wd
This helps identify upcoming compatibility issues.
Upgrade Recommendation
Upgrade Immediately If
✅ You want early visibility into upcoming PyTest changes
✅ You actively maintain your framework
✅ You monitor deprecation warnings
Additional Testing Required If
⚠️ You use –doctest-modules
⚠️ You have complex fixture hierarchies
⚠️ You maintain custom PyTest plugins
⚠️ You have enterprise-scale automation frameworks
My QA Assessment of PyTest 9.1.0
Biggest Change
Doctest fixture execution behavior.
Most Important Deprecation
Class-scoped fixture instance methods.
Highest Risk Area
Shared autouse fixtures.
Upgrade Risk
Medium.
Enterprise Recommendation
Upgrade in a controlled environment first.
Overall Rating
8.8/10
PyTest 9.1.0 is not a feature-heavy release, but it introduces important framework-level changes that automation teams should understand before moving to production.
More Relevant Articles
- From QA to AI Engineer: The REAL Roadmap Nobody Tells You (Complete Guide)
- The Future QA Engineer (2025–2030): Part Developer, Part Prompt Engineer, Part Data Curator
- How to Scrape Book Data & Turn It Into a Profitable Self-Published Book (2026 Guide)
External Resources
PyTest Release Notes: https://github.com/pytest-dev/pytest/releases/tag/9.1.0
PyTest Documentation: https://docs.pytest.org
PyTest Fixture Documentation: https://docs.pytest.org/en/stable/how-to/fixtures.html
Python Testing Guide: https://docs.python.org/3/library/unittest.html
Frequently Asked Questions
What is PyTest 9.1.0?
PyTest 9.1.0 is a release focused on fixture behavior updates, deprecations, and future compatibility improvements.
Does PyTest 9.1.0 contain breaking changes?
Yes. Teams using --doctest-modules may observe autouse fixtures executing twice in certain scenarios.
What is the biggest risk when upgrading?
Unexpected fixture execution behavior in complex test frameworks.
Should teams upgrade immediately?
Most teams should first validate fixture-heavy test suites in staging environments.
What should QA engineers test first?
Autouse fixtures, doctests, teardown logic, and session-scoped resources.
Does this affect Playwright Python projects?
Potentially yes, especially projects using session-level setup and authentication fixtures.
How can teams prepare for future releases?
Address deprecation warnings now and move affected fixture implementations into conftest.py.
Final Thoughts
PyTest 9.1.0 is a strategically important release because it signals the future direction of fixture management and framework consistency. While the release may appear small on the surface, the fixture behavior changes and deprecations could impact large automation frameworks if not reviewed carefully.
Organizations using PyTest for Playwright, Selenium, API Testing, AI Testing, and enterprise automation should perform targeted regression testing before upgrading production pipelines.



