Remove OutputVerbosity.verbose

This commit is contained in:
Bruno Oliveira 2023-11-07 19:18:16 -03:00
parent 1e918147ea
commit b8714de594
2 changed files with 4 additions and 29 deletions

View File

@ -1705,16 +1705,6 @@ class OutputVerbosity:
def __init__(self, config: Config) -> None: def __init__(self, config: Config) -> None:
self._config = config self._config = config
@property
def verbose(self) -> int:
"""
Application wide verbosity level.
Same as the traditional ``config.getoption("verbose")``.
"""
assert isinstance(self._config.option.verbose, int)
return self._config.option.verbose
def get(self, verbosity_type: VerbosityType = VerbosityType.Global) -> int: def get(self, verbosity_type: VerbosityType = VerbosityType.Global) -> int:
"""Return verbosity level for the given output type. """Return verbosity level for the given output type.
@ -1725,7 +1715,9 @@ class OutputVerbosity:
level = self._config.getini(OutputVerbosity._ini_name(verbosity_type)) level = self._config.getini(OutputVerbosity._ini_name(verbosity_type))
if level == OutputVerbosity.DEFAULT: if level == OutputVerbosity.DEFAULT:
return self.verbose assert isinstance(self._config.option.verbose, int)
return self._config.option.verbose
return int(level) return int(level)
@staticmethod @staticmethod

View File

@ -2196,23 +2196,6 @@ class TestOutputVerbosity:
parser, TestOutputVerbosity.SOME_OUTPUT_TYPE, help="some help text" parser, TestOutputVerbosity.SOME_OUTPUT_TYPE, help="some help text"
) )
def test_verbose_matches_option_verbose(
self, pytester: Pytester, tmp_path: Path
) -> None:
tmp_path.joinpath("pytest.ini").write_text(
textwrap.dedent(
"""\
[pytest]
addopts = --verbose
"""
),
encoding="utf-8",
)
config = pytester.parseconfig(tmp_path)
assert config.option.verbose == config.output_verbosity.verbose
def test_level_matches_verbose_when_not_specified( def test_level_matches_verbose_when_not_specified(
self, pytester: Pytester, tmp_path: Path self, pytester: Pytester, tmp_path: Path
) -> None: ) -> None:
@ -2231,7 +2214,7 @@ class TestOutputVerbosity:
assert ( assert (
config.output_verbosity.get(TestOutputVerbosity.SOME_OUTPUT_TYPE) config.output_verbosity.get(TestOutputVerbosity.SOME_OUTPUT_TYPE)
== config.output_verbosity.verbose == config.option.verbose
) )
def test_level_matches_specified_override( def test_level_matches_specified_override(