Skip to content

Pytest doen't rewrite conftest plugins #13517

Open
@Tusenka

Description

@Tusenka

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:

https://github.com/Tusenka/pytest/tree/disable_assertion_rewriting_external_modules/testing/example_scripts/rewrite

Expected result:

It sees the conftest plugin "some_plugin "for rewritng.

Result:

It doesn't see conftest plugins:
image
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']

`

def _mark_plugins_for_rewrite(

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:

Image

  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions