python - multiple custom plugins in py.test -
my question regarding multiple custom plugins in pytest. have 2 (or more) pytest plugins created installed using setuptools , pytest11 entry point, each plugin has own setup.py. seems first installed plugin active. have verified via print statements in pytest_configure hook. if first installed plugin uninstalled, second configure hook second plugin seems called. also, same behavior observed addoption hook, options plugin installed second unrecognized.
i'm thoroughly confused because i've used third party plugins , seem work fine. aren't hooks installed plugins supposed called ? problem way plugins installed, i.e. setuptools ? (the command use python setup.py -v install). pip correctly shows plugin modules installed.
edit: names different, below setup files:
from setuptools import setup setup( name="pytest_suite", version="0.1", packages=['suite_util'], # following makes plugin available pytest entry_points={ 'pytest11': [ 'name_of_plugin = suite_util.conftest', ] }, )
and
from setuptools import setup setup( name="pytest_auto_framework", version="0.1", packages=['automation_framework'], # following makes plugin available pytest entry_points={ 'pytest11': [ 'name_of_plugin = automation_framework.conftest', ] }, )
if pytest entry points both have same name (as in example above), only first 1 loaded pytest.
note this not inherent limitation of pkg_resources
entry points due way plugins registered in pytest. there can 1 plugin same name - makes sense imho.
Comments
Post a Comment