docstr: Test regression with --lf running into NoMatch error.
  
  This was caused by it not collecting (non-failed) nodes given as
  arguments.
docstr_tok: ["Test","regression","with","--","lf","running","into","NoMatch","error",".","This","was","caused","by","it","not","collecting","(","non-failed",")","nodes","given","as","arguments","."]
code: def test_lastfailed_args_with_deselected(
      self, pytester: Pytester
  ) -> None:
      """Test regression with --lf running into NoMatch error.
  
      This was caused by it not collecting (non-failed) nodes given as
      arguments.
      """
      pytester.makepyfile(
          **{
              "pkg1/test_1.py": """
                      def test_pass(): pass
                      def test_fail(): assert 0
                  """,
          }
      )
      result = pytester.runpytest()
      result.stdout.fnmatch_lines(
          ["collected 2 items", "* 1 failed, 1 passed in *"]
      )
      assert result.ret == 1
  
      result = pytester.runpytest(
          "pkg1/test_1.py::test_pass", "--lf", "--co"
      )
      assert result.ret == 0
      result.stdout.fnmatch_lines(
          [
              "*collected 1 item",
              "run-last-failure: 1 known failures not in selected tests",
              "",
              "<Dir *>",
              "  <Dir pkg1>",
              "    <Module test_1.py>",
              "      <Function test_pass>",
          ],
          consecutive=True,
      )
  
      result = pytester.runpytest(
          "pkg1/test_1.py::test_pass",
          "pkg1/test_1.py::test_fail",
          "--lf",
          "--co",
      )
      assert result.ret == 0
      result.stdout.fnmatch_lines(
          [
              "collected 2 items / 1 deselected / 1 selected",
              "run-last-failure: rerun previous 1 failure",
              "",
              "<Dir *>",
              "  <Dir pkg1>",
              "    <Module test_1.py>",
              "      <Function test_fail>",
              "*= 1/2 tests collected (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 24 for calling the TestLastFailed obj's underlying member method code with example usage: obj.test_lastfailed_args_with_deselected(pytester) without return types