# Buggy code
def env_run_create_flags(parser: ArgumentParser) -> None:
    parser.add_argument(
        "--result-json",
        dest="result_json",
        metavar="path",
        of_type=Path,
        default=None,
        help="write a json file with detailed information about all commands and results involved",
    )
    parser.add_argument(
        "-s",
        "--skip-missing-interpreters",
        default="config",
        metavar="v",
        nargs="?",
        action=SkipMissingInterpreterAction,
        help="don't fail tests for missing interpreters: {config,true,false} choice",
    )
    parser.add_argument(
        "-r",
        "--recreate",
        dest="recreate",
        help="recreate the tox environments",
        action="store_true",
    )
    parser.add_argument(
        "-n",
        "--notest",
        dest="no_test",
        help="do not run the test commands",
        action="store_true",
    )
    parser.add_argument(
        "-b",
        "--pkg-only",
        "--sdistonly",
        action="store_true",
        help="only perform the packaging activity",
        dest="package_only",
    )
    parser.add_argument(
        "--installpkg",
        help="use specified package for installation into venv, instead of creating an sdist.",
        default=None,
        of_type=Path,
    )
    parser.add_argument(
        "--develop",
        action="store_true",
        help="install package in develop mode",
        dest="develop",
    )
    parser.add_argument(
        "--hashseed",
        metavar="SEED",
        help="set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range "
        "[1, 4294967295] ([1, 1024] on Windows). Passing 'noset' suppresses this behavior.",
        type=str,
        default="noset",
    )
    parser.add_argument(
        "--discover",
        dest="discover",
        nargs="+",
        metavar="path",
        help="for python discovery first try the python executables under these paths",
        default=[],
    )
    parser.add_argument(
        "--no-recreate-pkg",
        dest="no_recreate_pkg",
        help="if recreate is set do not recreate packaging tox environment(s)",
        action="store_true",
    )
    parser.add_argument(
        "--skip-pkg-install",
        dest="skip_pkg_install",
        help="skip package installation for this run",
        action="store_true",
    )


# Traceback (AttributeError)
ROOT: 111 D setup logging to DEBUG on pid 483153 [tox/report.py:211]
ROOT: 143 W will run in automatically provisioned tox, host /home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3 is missing [requires (has)]: pip>=20.3.3 (20.3.1) [tox/provision.py:85]
ROOT: 156 I find interpreter for spec PythonSpec(path=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3) [virtualenv/discovery/builtin.py:62]
ROOT: 156 D discover exe for PythonInfo(spec=CPython3.7.9.final.0-64, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) in /usr [virtualenv/discovery/py_info.py:371]
ROOT: 156 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 157 D Attempting to acquire lock 139798871184528 on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:270]
ROOT: 157 D Lock 139798871184528 acquired on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:274]
ROOT: 157 D got python info of /usr/bin/python3.7 from /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 157 D Attempting to release lock 139798871184528 on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:315]
ROOT: 157 D Lock 139798871184528 released on /home/domdf/.local/share/virtualenv/py_info/1/fd69f43f58546b570e94fd7eba7b65e6bcc7a5bbc4eab0408017d18902915d69.lock [filelock.py:318]
ROOT: 158 I proposed PythonInfo(spec=CPython3.7.9.final.0-64, system=/usr/bin/python3.7, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) [virtualenv/discovery/builtin.py:68]
ROOT: 158 D accepted PythonInfo(spec=CPython3.7.9.final.0-64, system=/usr/bin/python3.7, exe=/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/python3, platform=linux, version='3.7.9 (default, Aug 18 2020, 02:07:21) \n[GCC 9.3.0]', encoding_fs_io=utf-8-UTF-8) [virtualenv/discovery/builtin.py:70]
ROOT: 177 I will run in a automatically provisioned python environment under /home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/.tox4/.tox/bin/python [tox/provision.py:103]
Traceback (most recent call last):
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/bin/tox4", line 10, in <module>
sys.exit(run())
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/run.py", line 21, in run
result = main(sys.argv[1:] if args is None else args)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/run.py", line 35, in main
result = provision(state)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/provision.py", line 87, in provision
return run_provision(requires, state)
File "/home/domdf/Python/01 GitHub Repos/03 Libraries/southwark/venv/lib/python3.7/site-packages/tox/provision.py", line 105, in run_provision
recreate = state.options.no_recreate_provision is False if state.options.recreate else False
AttributeError: 'Parsed' object has no attribute 'no_recreate_provision'

# Fixed code
def env_run_create_flags(parser: ArgumentParser) -> None:
    parser.add_argument(
        "--result-json",
        dest="result_json",
        metavar="path",
        of_type=Path,
        default=None,
        help="write a json file with detailed information about all commands and results involved",
    )
    parser.add_argument(
        "-s",
        "--skip-missing-interpreters",
        default="config",
        metavar="v",
        nargs="?",
        action=SkipMissingInterpreterAction,
        help="don't fail tests for missing interpreters: {config,true,false} choice",
    )
    parser.add_argument(
        "-n",
        "--notest",
        dest="no_test",
        help="do not run the test commands",
        action="store_true",
    )
    parser.add_argument(
        "-b",
        "--pkg-only",
        "--sdistonly",
        action="store_true",
        help="only perform the packaging activity",
        dest="package_only",
    )
    parser.add_argument(
        "--installpkg",
        help="use specified package for installation into venv, instead of creating an sdist.",
        default=None,
        of_type=Path,
    )
    parser.add_argument(
        "--develop",
        action="store_true",
        help="install package in develop mode",
        dest="develop",
    )
    parser.add_argument(
        "--hashseed",
        metavar="SEED",
        help="set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range "
        "[1, 4294967295] ([1, 1024] on Windows). Passing 'noset' suppresses this behavior.",
        type=str,
        default="noset",
    )
    parser.add_argument(
        "--discover",
        dest="discover",
        nargs="+",
        metavar="path",
        help="for python discovery first try the python executables under these paths",
        default=[],
    )
    parser.add_argument(
        "--no-recreate-pkg",
        dest="no_recreate_pkg",
        help="if recreate is set do not recreate packaging tox environment(s)",
        action="store_true",
    )
    parser.add_argument(
        "--skip-pkg-install",
        dest="skip_pkg_install",
        help="skip package installation for this run",
        action="store_true",
    )