code: def test_warn_when_deprecated_specified(recwarn) -> None:
      warning = DeprecationWarning("foo is deprecated")
  
      class Spec:
          @hookspec(warn_on_impl=warning)
          def foo(self):
              pass
  
      class Plugin:
          @hookimpl
          def foo(self):
              pass
  
      pm = PluginManager(hookspec.project_name)
      pm.add_hookspecs(Spec)
  
      with pytest.warns(DeprecationWarning) as records:
          pm.register(Plugin())
      (record,) = records
      assert record.message is warning
      assert record.filename == Plugin.foo.__code__.co_filename
      assert record.lineno == Plugin.foo.__code__.co_firstlineno
  
file_path: catboost/contrib/python/pluggy/py3/tests/test_details.py
imports: import pytest
  from pluggy import HookimplMarker
  from pluggy import HookspecMarker
  from pluggy import PluginManager
label_desc: Use image node_id 2 for calling a global function with example usage: test_warn_when_deprecated_specified(recwarn) without return types