More explict names

This commit is contained in:
Patrick Lannigan 2023-11-12 20:07:51 -05:00
parent 9580f4bf1d
commit b47b203eef
No known key found for this signature in database
GPG Key ID: BBF5D9DED1E4AAF9
4 changed files with 7 additions and 7 deletions

View File

@ -42,7 +42,7 @@ def pytest_addoption(parser: Parser) -> None:
help="Enables the pytest_assertion_pass hook. " help="Enables the pytest_assertion_pass hook. "
"Make sure to delete any previously generated pyc cache files.", "Make sure to delete any previously generated pyc cache files.",
) )
Config._add_ini( Config._add_verbosity_ini(
parser, parser,
Config.VERBOSITY_ASSERTIONS, Config.VERBOSITY_ASSERTIONS,
help=( help=(

View File

@ -1682,7 +1682,7 @@ class Config:
): ):
return global_level return global_level
level = self.getini(Config._ini_name(verbosity_type)) level = self.getini(Config._verbosity_ini_name(verbosity_type))
if level == Config._VERBOSITY_INI_DEFAULT: if level == Config._VERBOSITY_INI_DEFAULT:
return global_level return global_level
@ -1690,11 +1690,11 @@ class Config:
return int(level) return int(level)
@staticmethod @staticmethod
def _ini_name(verbosity_type: str) -> str: def _verbosity_ini_name(verbosity_type: str) -> str:
return f"verbosity_{verbosity_type}" return f"verbosity_{verbosity_type}"
@staticmethod @staticmethod
def _add_ini(parser: "Parser", verbosity_type: str, help: str) -> None: def _add_verbosity_ini(parser: "Parser", verbosity_type: str, help: str) -> None:
"""Add a output verbosity configuration option for the given output type. """Add a output verbosity configuration option for the given output type.
:param parser: Parser for command line arguments and ini-file values. :param parser: Parser for command line arguments and ini-file values.
@ -1705,7 +1705,7 @@ class Config:
:py:func:`config.get_verbosity(type) <pytest.Config.get_verbosity>`. :py:func:`config.get_verbosity(type) <pytest.Config.get_verbosity>`.
""" """
parser.addini( parser.addini(
Config._ini_name(verbosity_type), Config._verbosity_ini_name(verbosity_type),
help=help, help=help,
type="string", type="string",
default=Config._VERBOSITY_INI_DEFAULT, default=Config._VERBOSITY_INI_DEFAULT,

View File

@ -1907,7 +1907,7 @@ def test_fine_grained_assertion_verbosity(pytester: Pytester):
pytester.makeini( pytester.makeini(
f""" f"""
[pytest] [pytest]
{_Config._ini_name(_Config.VERBOSITY_ASSERTIONS)} = 2 {_Config._verbosity_ini_name(_Config.VERBOSITY_ASSERTIONS)} = 2
""" """
) )
result = pytester.runpytest(str(p)) result = pytester.runpytest(str(p))

View File

@ -2254,7 +2254,7 @@ class TestVerbosity:
class VerbosityIni: class VerbosityIni:
def pytest_addoption(self, parser: Parser) -> None: def pytest_addoption(self, parser: Parser) -> None:
Config._add_ini( Config._add_verbosity_ini(
parser, TestVerbosity.SOME_OUTPUT_TYPE, help="some help text" parser, TestVerbosity.SOME_OUTPUT_TYPE, help="some help text"
) )