Skip to content

Commit

Permalink
Fix option retrieval.
Browse files Browse the repository at this point in the history
Use getoption method to handle the case when the options aren't
set and use default value of 0 for verbose.
  • Loading branch information
smarlowucf authored and philpep committed Apr 18, 2021
1 parent 468f1d0 commit aff008d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions testinfra/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ def write(self, s):

@pytest.mark.trylast
def pytest_configure(config):
if config.option.verbose > 1:
if config.getoption("--verbose", 0) > 1:
root = logging.getLogger()
if not root.handlers:
root.addHandler(logging.NullHandler())
logging.getLogger("testinfra").setLevel(logging.DEBUG)
if config.option.nagios:
if config.getoption("--nagios"):
# disable & re-enable terminalreporter to write in a tempfile
reporter = config.pluginmanager.getplugin("terminalreporter")
if reporter:
Expand Down

0 comments on commit aff008d

Please sign in to comment.