code: def test_link_resolve(pytester: Pytester) -> None:
      """See: https://github.com/pytest-dev/pytest/issues/5965."""
      sub1 = pytester.mkpydir("sub1")
      p = sub1.joinpath("test_foo.py")
      p.write_text(
          textwrap.dedent(
              """
          import pytest
          def test_foo():
              raise AssertionError()
          """
          ),
          encoding="utf-8",
      )
  
      subst = subst_path_linux
      if sys.platform == "win32":
          subst = subst_path_windows
  
      with subst(p) as subst_p:
          result = pytester.runpytest(str(subst_p), "-v")
          # i.e.: Make sure that the error is reported as a relative path, not as a
          # resolved path.
          # See: https://github.com/pytest-dev/pytest/issues/5965
          stdout = result.stdout.str()
          assert "sub1/test_foo.py" not in stdout
  
          # i.e.: Expect drive on windows because we just have drive:filename, whereas
          # we expect a relative path on Linux.
          expect = (
              f"*{subst_p}*"
              if sys.platform == "win32"
              else "*sub2/test_foo.py*"
          )
          result.stdout.fnmatch_lines([expect])
  
file_path: pytest/testing/test_link_resolve.py
imports: import os.path
  import subprocess
  import sys
  import textwrap
  from contextlib import contextmanager
  from pathlib import Path
  from string import ascii_lowercase
  from _pytest.pytester import Pytester
label_desc: Use image node_id 3 for calling a global function with example usage: test_link_resolve(pytester) without return types