Skip to content

Commit 7500fe4

Browse files
authored
Correct the spelling of ArgSource.INVOCATION_DIR (#11333)
Config.ArgsSource.INCOVATION_DIR remains as a backwards compatibility alias.
1 parent 23b899f commit 7500fe4

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

changelog/11333.trivial.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Corrected the spelling of ``Config.ArgsSource.INVOCATION_DIR``.
2+
The previous spelling ``INCOVATION_DIR`` remains as an alias.

src/_pytest/config/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,8 @@ class ArgsSource(enum.Enum):
953953
#: Command line arguments.
954954
ARGS = enum.auto()
955955
#: Invocation directory.
956-
INCOVATION_DIR = enum.auto()
956+
INVOCATION_DIR = enum.auto()
957+
INCOVATION_DIR = INVOCATION_DIR # backwards compatibility alias
957958
#: 'testpaths' configuration value.
958959
TESTPATHS = enum.auto()
959960

@@ -1278,7 +1279,7 @@ def _decide_args(
12781279
else:
12791280
result = []
12801281
if not result:
1281-
source = Config.ArgsSource.INCOVATION_DIR
1282+
source = Config.ArgsSource.INVOCATION_DIR
12821283
result = [str(invocation_dir)]
12831284
return result, source
12841285

testing/test_config.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,24 @@ def pytest_load_initial_conftests(early_config, parser, args):
507507
result = pytester.runpytest("--foo=1")
508508
result.stdout.fnmatch_lines("* no tests ran in *")
509509

510+
def test_args_source_args(self, pytester: Pytester):
511+
config = pytester.parseconfig("--", "test_filename.py")
512+
assert config.args_source == Config.ArgsSource.ARGS
513+
514+
def test_args_source_invocation_dir(self, pytester: Pytester):
515+
config = pytester.parseconfig()
516+
assert config.args_source == Config.ArgsSource.INVOCATION_DIR
517+
518+
def test_args_source_testpaths(self, pytester: Pytester):
519+
pytester.makeini(
520+
"""
521+
[pytest]
522+
testpaths=*
523+
"""
524+
)
525+
config = pytester.parseconfig()
526+
assert config.args_source == Config.ArgsSource.TESTPATHS
527+
510528

511529
class TestConfigCmdlineParsing:
512530
def test_parsing_again_fails(self, pytester: Pytester) -> None:

0 commit comments

Comments
 (0)