handle non-true options in hookspec warning

This commit is contained in:
Ronny Pfannschmidt
2022-07-31 17:11:34 +02:00
parent 8c52dc5b7e
commit b1fb9a9c8d
2 changed files with 11 additions and 8 deletions

View File

@@ -29,11 +29,11 @@ def test_hookspec_via_function_attributes_are_deprecated():
def pytest_bad_hook(self):
pass
pytest_bad_hook.historic = True # type: ignore[attr-defined]
pytest_bad_hook.historic = False # type: ignore[attr-defined]
with pytest.warns(
PytestDeprecationWarning,
match=r"Please use the pytest\.hookspec\(historic=True\) decorator",
match=r"Please use the pytest\.hookspec\(historic=False\) decorator",
) as recorder:
pm.add_hookspecs(DeprecatedHookMarkerSpec)
(record,) = recorder