- added 'useful' output
This commit is contained in:
parent
9e8755b51f
commit
cee2cf30bf
|
@ -1115,35 +1115,31 @@ class Config:
|
||||||
self._mark_plugins_for_rewrite(hook)
|
self._mark_plugins_for_rewrite(hook)
|
||||||
self._warn_about_missing_assertion(mode)
|
self._warn_about_missing_assertion(mode)
|
||||||
|
|
||||||
|
|
||||||
def _mark_plugins_for_rewrite(self, hook) -> None:
|
def _mark_plugins_for_rewrite(self, hook) -> None:
|
||||||
"""Given an importhook, mark for rewrite any top-level
|
"""Given an importhook, mark for rewrite any top-level
|
||||||
modules or packages in the distribution package for
|
modules or packages in the distribution package for
|
||||||
all pytest plugins."""
|
all pytest plugins."""
|
||||||
self.pluginmanager.rewrite_hook = hook
|
try:
|
||||||
|
self.pluginmanager.rewrite_hook = hook
|
||||||
|
|
||||||
if os.environ.get("PYTEST_DISABLE_PLUGIN_AUTOLOAD"):
|
if os.environ.get("PYTEST_DISABLE_PLUGIN_AUTOLOAD"):
|
||||||
# We don't autoload from setuptools entry points, no need to continue.
|
# We don't autoload from setuptools entry points, no need to continue.
|
||||||
return
|
return
|
||||||
|
|
||||||
def _get_files(dist):
|
package_files = (
|
||||||
# dist.files does not make sense for dists
|
str(file)
|
||||||
# who are not stored on a filesystem
|
for dist in importlib_metadata.distributions()
|
||||||
# at least pyoxidizer does throw a
|
if any(ep.group == "pytest11" for ep in dist.entry_points)
|
||||||
# not implemented assertion in this case
|
for file in dist.files or []
|
||||||
try:
|
)
|
||||||
return dist.files
|
|
||||||
except NotImplementedError:
|
|
||||||
return []
|
|
||||||
|
|
||||||
package_files = (
|
for name in _iter_rewritable_modules(package_files):
|
||||||
str(file)
|
hook.mark_rewrite(name)
|
||||||
for dist in importlib_metadata.distributions()
|
except Exception as e:
|
||||||
if any(ep.group == "pytest11" for ep in dist.entry_points)
|
apropriate_output_function("unexpected exception %s while marking plugins for assertion rewrites, see LINK TO HELPFULL DOCUMENTATION", e)
|
||||||
for file in _get_files(dist) or []
|
raise e
|
||||||
)
|
|
||||||
|
|
||||||
for name in _iter_rewritable_modules(package_files):
|
|
||||||
hook.mark_rewrite(name)
|
|
||||||
|
|
||||||
def _validate_args(self, args: List[str], via: str) -> List[str]:
|
def _validate_args(self, args: List[str], via: str) -> List[str]:
|
||||||
"""Validate known args."""
|
"""Validate known args."""
|
||||||
|
|
Loading…
Reference in New Issue