Skip to content

Commit

Permalink
Remove OutputVerbosity.verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Nov 7, 2023
1 parent 1e91814 commit b8714de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
14 changes: 3 additions & 11 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,16 +1705,6 @@ class OutputVerbosity:
def __init__(self, config: Config) -> None:
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:
"""Return verbosity level for the given output type.
Expand All @@ -1725,7 +1715,9 @@ def get(self, verbosity_type: VerbosityType = VerbosityType.Global) -> int:
level = self._config.getini(OutputVerbosity._ini_name(verbosity_type))

if level == OutputVerbosity.DEFAULT:
return self.verbose
assert isinstance(self._config.option.verbose, int)
return self._config.option.verbose

return int(level)

Check warning on line 1721 in src/_pytest/config/__init__.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/config/__init__.py#L1721

Added line #L1721 was not covered by tests

@staticmethod
Expand Down
19 changes: 1 addition & 18 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2196,23 +2196,6 @@ def pytest_addoption(self, parser: Parser) -> None:
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(
self, pytester: Pytester, tmp_path: Path
) -> None:
Expand All @@ -2231,7 +2214,7 @@ def test_level_matches_verbose_when_not_specified(

assert (
config.output_verbosity.get(TestOutputVerbosity.SOME_OUTPUT_TYPE)
== config.output_verbosity.verbose
== config.option.verbose
)

def test_level_matches_specified_override(
Expand Down

0 comments on commit b8714de

Please sign in to comment.