Skip to content

Commit

Permalink
Merge d5ad382 into 0f7eea8
Browse files Browse the repository at this point in the history
  • Loading branch information
kdelee committed Sep 13, 2019
2 parents 0f7eea8 + d5ad382 commit d5db476
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
10 changes: 9 additions & 1 deletion tests/test_adhoc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import pytest
from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED, EXIT_INTERRUPTED # NOQA
try:
from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED, EXIT_INTERRUPTED # NOQA
except ImportError:
from _pytest.main import ExitCode
EXIT_OK = ExitCode.OK
EXIT_TESTSFAILED = ExitCode.TESTS_FAILED
EXIT_USAGEERROR = ExitCode.USAGE_ERROR
EXIT_INTERRUPTED = ExitCode.INTERRUPTED
EXIT_NOTESTSCOLLECTED = ExitCode.NO_TESTS_COLLECTED


@pytest.mark.old
Expand Down
6 changes: 5 additions & 1 deletion tests/test_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import pytest
from _pytest.main import EXIT_OK
try:
from _pytest.main import EXIT_OK
except ImportError:
from _pytest.main import ExitCode
EXIT_OK = ExitCode.OK


def test_ansible_adhoc(testdir, option):
Expand Down
9 changes: 7 additions & 2 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
import logging
from fnmatch import fnmatch
from _pytest.main import EXIT_OK, EXIT_NOTESTSCOLLECTED, EXIT_INTERRUPTED # NOQA

try:
from _pytest.main import EXIT_OK, EXIT_NOTESTSCOLLECTED, EXIT_INTERRUPTED # NOQA
except ImportError:
from _pytest.main import ExitCode
EXIT_OK = ExitCode.OK
EXIT_INTERRUPTED = ExitCode.INTERRUPTED
EXIT_NOTESTSCOLLECTED = ExitCode.NO_TESTS_COLLECTED

def assert_fnmatch_lines(lines, matches):
for match in matches:
Expand Down
14 changes: 11 additions & 3 deletions tests/test_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
except ImportError:
from unittest import mock
import re
from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED, EXIT_INTERRUPTED
try:
from _pytest.main import EXIT_OK, EXIT_TESTSFAILED, EXIT_USAGEERROR, EXIT_NOTESTSCOLLECTED, EXIT_INTERRUPTED # NOQA
except ImportError:
from _pytest.main import ExitCode
EXIT_OK = ExitCode.OK
EXIT_TESTSFAILED = ExitCode.TESTS_FAILED
EXIT_USAGEERROR = ExitCode.USAGE_ERROR
EXIT_INTERRUPTED = ExitCode.INTERRUPTED
EXIT_NOTESTSCOLLECTED = ExitCode.NO_TESTS_COLLECTED

if sys.version_info[0] == 2:
import __builtin__ as builtins # NOQA
Expand All @@ -35,7 +43,7 @@ def test_plugin_help(testdir):
' --become-user=ANSIBLE_BECOME_USER, --ansible-become-user=ANSIBLE_BECOME_USER',
' --ask-become-pass=ANSIBLE_ASK_BECOME_PASS, --ansible-ask-become-pass=ANSIBLE_ASK_BECOME_PASS',
# Check for the marker in --help
' ansible (args) * Ansible integration',
' ansible (args)*Ansible integration',
])


Expand Down Expand Up @@ -119,7 +127,7 @@ def test_func({0}):
assert result.ret == EXIT_INTERRUPTED
result.stdout.fnmatch_lines([
'collected 0 items / 1 errors',
'E *UsageError: Missing required parameter --ansible-host-pattern/--host-pattern',
'*UsageError: Missing required parameter --ansible-host-pattern/--host-pattern',
])


Expand Down

0 comments on commit d5db476

Please sign in to comment.