Correct the spelling of ArgSource.INVOCATION_DIR (#11333)

Config.ArgsSource.INCOVATION_DIR remains as a backwards compatibility
alias.
This commit is contained in:
Jon Parise 2023-08-23 02:21:17 -07:00 committed by GitHub
parent 23b899f31f
commit 7500fe44b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,2 @@
Corrected the spelling of ``Config.ArgsSource.INVOCATION_DIR``.
The previous spelling ``INCOVATION_DIR`` remains as an alias.

View File

@ -953,7 +953,8 @@ class Config:
#: Command line arguments. #: Command line arguments.
ARGS = enum.auto() ARGS = enum.auto()
#: Invocation directory. #: Invocation directory.
INCOVATION_DIR = enum.auto() INVOCATION_DIR = enum.auto()
INCOVATION_DIR = INVOCATION_DIR # backwards compatibility alias
#: 'testpaths' configuration value. #: 'testpaths' configuration value.
TESTPATHS = enum.auto() TESTPATHS = enum.auto()
@ -1278,7 +1279,7 @@ class Config:
else: else:
result = [] result = []
if not result: if not result:
source = Config.ArgsSource.INCOVATION_DIR source = Config.ArgsSource.INVOCATION_DIR
result = [str(invocation_dir)] result = [str(invocation_dir)]
return result, source return result, source

View File

@ -507,6 +507,24 @@ class TestParseIni:
result = pytester.runpytest("--foo=1") result = pytester.runpytest("--foo=1")
result.stdout.fnmatch_lines("* no tests ran in *") 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: class TestConfigCmdlineParsing:
def test_parsing_again_fails(self, pytester: Pytester) -> None: def test_parsing_again_fails(self, pytester: Pytester) -> None: