code: def test_lastfailed_difference_invocations(
      self, pytester: Pytester, monkeypatch: MonkeyPatch
  ) -> None:
      monkeypatch.setattr("sys.dont_write_bytecode", True)
      pytester.makepyfile(
          test_a="""
                  def test_a1(): assert 0
                  def test_a2(): assert 1
              """,
          test_b="def test_b1(): assert 0",
      )
      p = pytester.path.joinpath("test_a.py")
      p2 = pytester.path.joinpath("test_b.py")
  
      result = pytester.runpytest()
      result.stdout.fnmatch_lines(["*2 failed*"])
      result = pytester.runpytest("--lf", p2)
      result.stdout.fnmatch_lines(["*1 failed*"])
  
      pytester.makepyfile(test_b="def test_b1(): assert 1")
      result = pytester.runpytest("--lf", p2)
      result.stdout.fnmatch_lines(["*1 passed*"])
      result = pytester.runpytest("--lf", p)
      result.stdout.fnmatch_lines(
          [
              "collected 2 items / 1 deselected / 1 selected",
              "run-last-failure: rerun previous 1 failure",
              "*= 1 failed, 1 deselected in *",
          ]
      )
  
imports: import os
  import shutil
  from pathlib import Path
  from typing import Generator
  from typing import List
  import pytest
  from _pytest.config import ExitCode
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.pytester import Pytester
  from _pytest.tmpdir import TempPathFactory
label_desc: Use image node_id 4 for calling the TestLastFailed obj's underlying member method code with example usage: obj.test_lastfailed_difference_invocations(pytester, monkeypatch) without return types