conftest.py 505 B

1234567891011121314151617181920212223242526
  1. import pytest
  2. @pytest.fixture(
  3. params=[lambda spec: spec, lambda spec: spec()],
  4. ids=["spec-is-class", "spec-is-instance"],
  5. )
  6. def he_pm(request, pm):
  7. from pluggy import HookspecMarker
  8. hookspec = HookspecMarker("example")
  9. class Hooks(object):
  10. @hookspec
  11. def he_method1(self, arg):
  12. return arg + 1
  13. pm.add_hookspecs(request.param(Hooks))
  14. return pm
  15. @pytest.fixture
  16. def pm():
  17. from pluggy import PluginManager
  18. return PluginManager("example")