-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanismtype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
More context behind this issue is available at: pytest-dev/pytest-mock#167
TL;DR:
The function _iter_rewritable_modules
doesn't detect modules that can be rewritten, if they are installed by a method which doesn't adopt the dist-info format.
An easy way to reproduce the problem is to: pip install pytest-mock
in one environment and pip install -e 'git+https://github.com/pytest-dev/pytest-mock#egg=pytest-mock'
in another and compare the output for:
import importlib_metadata
from _pytest.config import _iter_rewritable_modules
for x in importlib_metadata.distributions():
if x.metadata['Name']=='pytest-mock':
for _file in x.files:
print("file: {}; module_or_pkg_name: {}".format(str(_file), list(_iter_rewritable_modules([str(_file)]))))
Because of this problem, rpm maintainers are unable to run the tests for pytest-mock, since they rely on python setup.py install
which creates egg-info directories.
Metadata
Metadata
Assignees
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanismtype: bugproblem that needs to be addressedproblem that needs to be addressed