avoid tests when ncclient is not installed

This commit is contained in:
Brian Coca 2018-09-28 16:21:00 -04:00 committed by Brian Coca
parent c0de93310f
commit d3d812b604
2 changed files with 6 additions and 1 deletions

View file

@ -21,6 +21,7 @@ __metaclass__ = type
from io import StringIO
import sys
import pytest
from ansible.compat.tests import mock
from ansible.compat.tests import unittest
@ -43,8 +44,9 @@ from ansible.plugins.connection.docker import Connection as DockerConnection
from ansible.plugins.connection.network_cli import Connection as NetworkCliConnection
from ansible.plugins.connection.httpapi import Connection as HttpapiConnection
PY3 = sys.version_info[0] == 3
pytest.importorskip("ncclient")
PY3 = sys.version_info[0] == 3
builtin_import = __import__
mock_ncclient = MagicMock(name='ncclient')

View file

@ -23,6 +23,7 @@ __metaclass__ = type
import sys
import re
import json
import pytest
from io import StringIO
@ -31,6 +32,8 @@ from ansible.compat.tests.mock import patch, MagicMock, PropertyMock
from ansible.errors import AnsibleConnectionFailure
from ansible.playbook.play_context import PlayContext
pytest.importorskip("ncclient")
PY3 = sys.version_info[0] == 3
builtin_import = __import__