Browse Source

Make mock import python 2.7 compatible

In python3.x mock is now part of unittest library.
For being still compatible with python 2.7 we need to
catch import error when trying to import unittest.mock

Change-Id: I6aca21bea4f1563e1f3c5ecfb91c511191eb409b
changes/97/716597/1
Mathieu Bultel 2 years ago
parent
commit
eb0158c35a
  1. 5
      validations_libs/tests/test_ansible.py
  2. 5
      validations_libs/tests/test_utils.py
  3. 5
      validations_libs/tests/test_validations_list.py
  4. 5
      validations_libs/tests/test_validations_run.py
  5. 5
      validations_libs/tests/test_validations_show.py

5
validations_libs/tests/test_ansible.py

@ -13,7 +13,10 @@
# under the License.
#
from unittest import mock
try:
from unittest import mock
except ImportError:
import mock
from unittest import TestCase
from ansible_runner import Runner

5
validations_libs/tests/test_utils.py

@ -13,7 +13,10 @@
# under the License.
#
from unittest import mock
try:
from unittest import mock
except ImportError:
import mock
from unittest import TestCase
from validations_libs import utils

5
validations_libs/tests/test_validations_list.py

@ -13,7 +13,10 @@
# under the License.
#
from unittest import mock
try:
from unittest import mock
except ImportError:
import mock
from unittest import TestCase
from validations_libs.tests import fakes

5
validations_libs/tests/test_validations_run.py

@ -13,7 +13,10 @@
# under the License.
#
from unittest import mock
try:
from unittest import mock
except ImportError:
import mock
from unittest import TestCase
from validations_libs.tests import fakes

5
validations_libs/tests/test_validations_show.py

@ -13,7 +13,10 @@
# under the License.
#
from unittest import mock
try:
from unittest import mock
except ImportError:
import mock
from unittest import TestCase
from validations_libs.tests import fakes

Loading…
Cancel
Save