code: def pytest_addoption(parser):
      group = parser.getgroup("general")
      group.addoption(
          "--lf",
          "--last-failed",
          action="store_true",
          dest="lf",
          help="rerun only the tests that failed "
          "at the last run (or all if none failed)",
      )
      group.addoption(
          "--ff",
          "--failed-first",
          action="store_true",
          dest="failedfirst",
          help="run all tests but run the last failures first.  "
          "This may re-order tests and thus lead to "
          "repeated fixture setup/teardown",
      )
      group.addoption(
          "--nf",
          "--new-first",
          action="store_true",
          dest="newfirst",
          help="run tests from new files first, then the rest of the tests "
          "sorted by file mtime",
      )
      group.addoption(
          "--cache-show",
          action="append",
          nargs="?",
          dest="cacheshow",
          help=(
              "show cache contents, don't perform collection or tests. "
              "Optional argument: glob (default: '*')."
          ),
      )
      group.addoption(
          "--cache-clear",
          action="store_true",
          dest="cacheclear",
          help="remove all cache contents at start of test run.",
      )
      cache_dir_default = ".pytest_cache"
      if "TOX_ENV_DIR" in os.environ:
          cache_dir_default = os.path.join(
              os.environ["TOX_ENV_DIR"], cache_dir_default
          )
      parser.addini(
          "cache_dir",
          default=cache_dir_default,
          help="cache directory path.",
      )
      group.addoption(
          "--lfnf",
          "--last-failed-no-failures",
          action="store",
          dest="last_failed_no_failures",
          choices=("all", "none"),
          default="all",
          help="which tests to run with no previously (known) failures.",
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import os
  from collections import OrderedDict
  import attr
  import py
  import six
  import pytest
  from .compat import _PY2
  from .pathlib import Path
  from .pathlib import resolve_from_str
  from .pathlib import rm_rf
label_desc: Use image node_id 1 for calling a global function with example usage: pytest_addoption(parser) without return types