diff --git a/changelog/11333.trivial.rst b/changelog/11333.trivial.rst new file mode 100644 index 00000000000..846f79e34a7 --- /dev/null +++ b/changelog/11333.trivial.rst @@ -0,0 +1,2 @@ +Corrected the spelling of ``Config.ArgsSource.INVOCATION_DIR``. +The previous spelling ``INCOVATION_DIR`` remains as an alias. diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 8dbaf7c70e5..1d9c49aa111 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -953,7 +953,8 @@ class ArgsSource(enum.Enum): #: Command line arguments. ARGS = enum.auto() #: Invocation directory. - INCOVATION_DIR = enum.auto() + INVOCATION_DIR = enum.auto() + INCOVATION_DIR = INVOCATION_DIR # backwards compatibility alias #: 'testpaths' configuration value. TESTPATHS = enum.auto() @@ -1278,7 +1279,7 @@ def _decide_args( else: result = [] if not result: - source = Config.ArgsSource.INCOVATION_DIR + source = Config.ArgsSource.INVOCATION_DIR result = [str(invocation_dir)] return result, source diff --git a/testing/test_config.py b/testing/test_config.py index 04161f238d8..ded30790188 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -507,6 +507,24 @@ def pytest_load_initial_conftests(early_config, parser, args): result = pytester.runpytest("--foo=1") result.stdout.fnmatch_lines("* no tests ran in *") + def test_args_source_args(self, pytester: Pytester): + config = pytester.parseconfig("--", "test_filename.py") + assert config.args_source == Config.ArgsSource.ARGS + + def test_args_source_invocation_dir(self, pytester: Pytester): + config = pytester.parseconfig() + assert config.args_source == Config.ArgsSource.INVOCATION_DIR + + def test_args_source_testpaths(self, pytester: Pytester): + pytester.makeini( + """ + [pytest] + testpaths=* + """ + ) + config = pytester.parseconfig() + assert config.args_source == Config.ArgsSource.TESTPATHS + class TestConfigCmdlineParsing: def test_parsing_again_fails(self, pytester: Pytester) -> None: