|
13 | 13 | pytest_plugins = ['pytester']
|
14 | 14 |
|
15 | 15 |
|
16 |
| -def test_nagios_notest(testdir): |
17 |
| - result = testdir.runpytest('--nagios', '-q', '--tb=no') |
| 16 | +def test_nagios_notest(testdir, request): |
| 17 | + params = ['--nagios', '-q', '--tb=no'] |
| 18 | + if not request.config.pluginmanager.hasplugin('pytest11.testinfra'): |
| 19 | + params.extend(['-p', 'testinfra.plugin']) |
| 20 | + result = testdir.runpytest(*params) |
18 | 21 | assert result.ret == 0
|
19 | 22 | lines = result.stdout.str().splitlines()
|
20 | 23 | assert lines[0].startswith('TESTINFRA OK - 0 passed, 0 failed, 0 skipped')
|
21 | 24 |
|
22 | 25 |
|
23 |
| -def test_nagios_ok(testdir): |
| 26 | +def test_nagios_ok(testdir, request): |
24 | 27 | testdir.makepyfile('def test_ok(): pass')
|
25 |
| - result = testdir.runpytest('--nagios', '-q', '--tb=no') |
| 28 | + params = ['--nagios', '-q', '--tb=no'] |
| 29 | + if not request.config.pluginmanager.hasplugin('pytest11.testinfra'): |
| 30 | + params.extend(['-p', 'testinfra.plugin']) |
| 31 | + result = testdir.runpytest(*params) |
26 | 32 | assert result.ret == 0
|
27 | 33 | lines = result.stdout.str().splitlines()
|
28 | 34 | assert lines[0].startswith('TESTINFRA OK - 1 passed, 0 failed, 0 skipped')
|
29 | 35 | assert lines[1][0] == '.'
|
30 | 36 |
|
31 | 37 |
|
32 |
| -def test_nagios_fail(testdir): |
| 38 | +def test_nagios_fail(testdir, request): |
33 | 39 | testdir.makepyfile('def test_ok(): pass\ndef test_fail(): assert False')
|
34 |
| - result = testdir.runpytest('--nagios', '-q', '--tb=no') |
| 40 | + params = ['--nagios', '-q', '--tb=no'] |
| 41 | + if not request.config.pluginmanager.hasplugin('pytest11.testinfra'): |
| 42 | + params.extend(['-p', 'testinfra.plugin']) |
| 43 | + result = testdir.runpytest(*params) |
35 | 44 | assert result.ret == 2
|
36 | 45 | lines = result.stdout.str().splitlines()
|
37 | 46 | assert lines[0].startswith(
|
|
0 commit comments