docstr: #4445: Make sure the warning points to a reasonable location
  See origin of _issue_warning_captured at: _pytest.assertion.rewrite.py:241
docstr_tok: ["#","4445",":","Make","sure","the","warning","points","to","a","reasonable","location","See","origin","of","_issue_warning_captured","at",":","_pytest.assertion.rewrite.py:241"]
code: def test_issue4445_rewrite(self, pytester: Pytester, capwarn) -> None:
      """#4445: Make sure the warning points to a reasonable location
      See origin of _issue_warning_captured at: _pytest.assertion.rewrite.py:241
      """
      pytester.makepyfile(some_mod="")
      conftest = pytester.makeconftest(
          """
                  import some_mod
                  import pytest
  
                  pytest.register_assert_rewrite("some_mod")
              """
      )
      pytester.parseconfig()
  
      # with stacklevel=5 the warning originates from register_assert_rewrite
      # function in the created conftest.py
      assert len(capwarn.captured) == 1
      warning, location = capwarn.captured.pop()
      file, lineno, func = location
  
      assert "Module already imported" in str(warning.message)
      assert file == str(conftest)
      assert func == "<module>"  # the above conftest.py
      assert lineno == 4
  
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 2 for calling the TestStackLevel obj's underlying member method code with example usage: obj.test_issue4445_rewrite(pytester, capwarn) without return types