Skip to content

Commit aff008d

Browse files
smarlowucfphilpep
authored andcommitted
Fix option retrieval.
Use getoption method to handle the case when the options aren't set and use default value of 0 for verbose.
1 parent 468f1d0 commit aff008d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

testinfra/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ def write(self, s):
184184

185185
@pytest.mark.trylast
186186
def pytest_configure(config):
187-
if config.option.verbose > 1:
187+
if config.getoption("--verbose", 0) > 1:
188188
root = logging.getLogger()
189189
if not root.handlers:
190190
root.addHandler(logging.NullHandler())
191191
logging.getLogger("testinfra").setLevel(logging.DEBUG)
192-
if config.option.nagios:
192+
if config.getoption("--nagios"):
193193
# disable & re-enable terminalreporter to write in a tempfile
194194
reporter = config.pluginmanager.getplugin("terminalreporter")
195195
if reporter:

0 commit comments

Comments
 (0)