Skip to content

Commit

Permalink
pytest-dev#9422 added the default value to be passed in for verbose …
Browse files Browse the repository at this point in the history
…if not assigned
  • Loading branch information
GTowers1 committed Aug 10, 2024
1 parent cb98538 commit e734f30
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion doc/en/builtin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
Example::
def test_foo(pytestconfig):
if pytestconfig.getoption("verbose") > 0:
if pytestconfig.getoption("verbose",0) > 0:
...
record_property -- .../_pytest/junitxml.py:280
Expand Down
2 changes: 1 addition & 1 deletion doc/en/example/simple.rst
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ display more information if applicable:
def pytest_report_header(config):
if config.getoption("verbose") > 0:
if config.getoption("verbose",0) > 0:
return ["info1: did you know that ...", "did you?"]
which will add info only when run with "--v":
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def get_last_failed_paths(self) -> set[Path]:
return {x for x in result if x.exists()}

def pytest_report_collectionfinish(self) -> str | None:
if self.active and self.config.getoption("verbose") >= 0:
if self.active and self.config.getoption("verbose",0) >= 0:
return f"run-last-failure: {self._report_status}"
return None

Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ def pytest_runtestloop(self, session: Session) -> Generator[None, object, object
if session.config.option.collectonly:
return (yield)

if self._log_cli_enabled() and self._config.getoption("verbose") < 1:
if self._log_cli_enabled() and self._config.getoption("verbose",0) < 1:
# The verbose flag is needed to avoid messy test progress output.
self._config.option.verbose = 1

Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def importtestmodule(
) from e
except ImportError as e:
exc_info = ExceptionInfo.from_current()
if config.getoption("verbose") < 2:
if config.getoption("verbose",0) < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/stepwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def pytest_runtest_logreport(self, report: TestReport) -> None:
self.lastfailed = None

def pytest_report_collectionfinish(self) -> str | None:
if self.config.getoption("verbose") >= 0 and self.report_status:
if self.config.getoption("verbose",0) >= 0 and self.report_status:
return f"stepwise: {self.report_status}"
return None

Expand Down
2 changes: 1 addition & 1 deletion testing/python/approx.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def report_failure(self, out, test, example, got):

@contextmanager
def temporary_verbosity(config, verbosity=0):
original_verbosity = config.getoption("verbose")
original_verbosity = config.getoption("verbose",0)
config.option.verbose = verbosity
try:
yield
Expand Down
2 changes: 1 addition & 1 deletion testing/test_assertrewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def f() -> None:
msg = getmsg(f)
assert msg is not None
line = msg.splitlines()[0]
if request.config.getoption("verbose") > 1:
if request.config.getoption("verbose",0) > 1:
assert line == (
"assert '12345678901234567890123456789012345678901234567890A' "
"== '12345678901234567890123456789012345678901234567890B'"
Expand Down

0 comments on commit e734f30

Please sign in to comment.