docstr: #4445: Make sure the warning points to a reasonable location
docstr_tok: ["#","4445",":","Make","sure","the","warning","points","to","a","reasonable","location"]
code: def test_issue4445_import_plugin(
      self, pytester: Pytester, capwarn
  ) -> None:
      """#4445: Make sure the warning points to a reasonable location"""
      pytester.makepyfile(
          some_plugin="""
              import pytest
              pytest.skip("thing", allow_module_level=True)
              """
      )
      pytester.syspathinsert()
      pytester.parseconfig("-p", "some_plugin")
  
      # with stacklevel=2 the warning should originate from
      # config.PytestPluginManager.import_plugin is thrown by a skipped plugin
  
      assert len(capwarn.captured) == 1
      warning, location = capwarn.captured.pop()
      file, _, func = location
  
      assert "skipped plugin 'some_plugin': thing" in str(
          warning.message
      )
      assert f"config{os.sep}__init__.py" in file
      assert func == "_warn_about_skipped_plugins"
  
imports: import os
  import sys
  import warnings
  from typing import List
  from typing import Optional
  from typing import Tuple
  import pytest
  from _pytest.fixtures import FixtureRequest
  from _pytest.pytester import Pytester
label_desc: Use image node_id 5 for calling the TestStackLevel obj's underlying member method code with example usage: obj.test_issue4445_import_plugin(pytester, capwarn) without return types