code: def test_clean_up(pytester: Pytester) -> None:
      """Test that the plugin cleans up after itself."""
      # This is tough to test behaviorally because the cleanup really runs last.
      # So the test make several implementation assumptions:
      # - Cleanup is done in pytest_unconfigure().
      # - Not a hook wrapper.
      # So we can add a hook wrapper ourselves to test what it does.
      pytester.makefile(
          ".ini", pytest="[pytest]\npythonpath=I_SHALL_BE_REMOVED\n"
      )
      pytester.makepyfile(test_foo="""def test_foo(): pass""")
  
      before: Optional[List[str]] = None
      after: Optional[List[str]] = None
  
      class Plugin:
          @pytest.hookimpl(wrapper=True, tryfirst=True)
          def pytest_unconfigure(self) -> Generator[None, None, None]:
              nonlocal before, after
              before = sys.path.copy()
              try:
                  return (yield)
              finally:
                  after = sys.path.copy()
  
      result = pytester.runpytest_inprocess(plugins=[Plugin()])
      assert result.ret == 0
  
      assert before is not None
      assert after is not None
      assert any("I_SHALL_BE_REMOVED" in entry for entry in before)
      assert not any("I_SHALL_BE_REMOVED" in entry for entry in after)
  
file_path: pytest/testing/test_python_path.py
imports: import sys
  from textwrap import dedent
  from typing import Generator
  from typing import List
  from typing import Optional
  import pytest
  from _pytest.pytester import Pytester
label_desc: Use image node_id 6 for calling a global function with example usage: test_clean_up(pytester) and returns: unknown