pytest-dev / pytest-dev/pytest
Pytest doen't rewrite conftest plugins
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
As per discussed:
I try to run pytest rewriting for custom plugins. However it doesn't load a conftest plugin at the rewrting stage.
Example:
Expected result:
It sees the conftest plugin "some_plugin "for rewritng.
Result:
It doesn't see conftest plugins:
Result of provided plugins:
['pytest', 'zope.interface', 'idna', 'anyio', 'sniffio', 'filelock', 'cachetools', 'incremental', 'greenlet', 'pluggy', 'hypothesis', 'Automat', 'wheel', 'virtualenv', 'coverage', 'pip', 'distlib', 'mock', 'pre_commit', 'typing_extensions', 'elementpath', 'pytest-twisted', 'PyYAML', 'pyproject-api', 'identify', 'colorama', 'urllib3', 'hyperlink', 'Pygments', 'sortedcontainers', 'constantly', 'nodeenv', 'xmlschema', 'setuptools', 'attrs', 'requests', 'pytest', 'exceptiongroup', 'decorator', 'platformdirs', 'packaging', 'charset-normalizer', 'cfgv', 'Twisted', 'certifi', 'chardet', 'tox', 'argcomplete', 'iniconfig', 'jaraco.collections', 'zipp', 'typeguard', 'wheel', 'importlib_metadata', 'jaraco.text', 'jaraco.context', 'autocommand', 'tomli', 'typing_extensions', 'more-itertools', 'jaraco.functools', 'packaging', 'platformdirs', 'inflect', 'backports.tarfile']
Pip info:
anyio 4.9.0
argcomplete 3.6.2
attrs 25.3.0
Automat 25.4.16
cachetools 5.5.2
certifi 2025.4.26
cfgv 3.4.0
chardet 5.2.0
charset-normalizer 3.4.2
colorama 0.4.6
constantly 23.10.4
coverage 7.8.0
decorator 5.2.1
distlib 0.3.9
elementpath 5.0.0
exceptiongroup 1.3.0
filelock 3.18.0
greenlet 3.2.2
hyperlink 21.0.0
hypothesis 6.131.9
identify 2.6.12
idna 3.10
incremental 24.7.2
iniconfig 2.1.0
mock 5.2.0
nodeenv 1.9.1
packaging 25.0
pip 25.0.1
platformdirs 4.3.8
pluggy 1.5.0
pre_commit 4.2.0
Pygments 2.19.1
pyproject-api 1.9.1
pytest 8.5.0.dev32+g1d5a61269.d20250613 /home/cas12/PycharmProjects/pytest-play
pytest-twisted 1.14.3
PyYAML 6.0.2
requests 2.32.3
setuptools 78.1.0
sniffio 1.3.1
sortedcontainers 2.4.0
tox 4.26.0
Twisted 24.11.0
typing_extensions 4.13.2
urllib3 2.4.0
virtualenv 20.31.2
wheel 0.45.1
xmlschema 4.0.1
zope.interface 7.2
Pytest and OS:
- a detailed description of the bug or problem you are having
- output of
pip listfrom the virtual environment you are using - pytest and operating system versions
- minimal example if possible
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided reproduction under testing/example_scripts/rewrite and inspect src/_pytest/config/init.py around line 1293. Trace how assertion rewriting discovers plugins and compare the observed list with the expected conftest plugin. Done means the reproduction detects and rewrites the conftest plugin without regressing existing plugin handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100