diff --git a/setup.py b/setup.py index 80648214..34cf6182 100755 --- a/setup.py +++ b/setup.py @@ -62,5 +62,5 @@ setup( "dogpile.cache", ], extras_require={':python_version=="2.7"': ["enum34", "lockfile"]}, - tests_require=["mock", "pytest", "pytest-cov"], + tests_require=["pytest", "pytest-cov"], ) diff --git a/test-requirements.txt b/test-requirements.txt index 475f0328..2d921c76 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -mock +mock; python_version < '3.3' parameterized pytest pytest-cov diff --git a/tests/helpers.py b/tests/helpers.py index b09d10a8..41df06e8 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -7,7 +7,10 @@ import shutil import tempfile from collections import defaultdict -import mock +try: + from unittest import mock +except ImportError: + import mock import six from kobo.rpmlib import parse_nvr diff --git a/tests/test_arch.py b/tests/test_arch.py index 5112caea..e99c8251 100644 --- a/tests/test_arch.py +++ b/tests/test_arch.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import unittest from pungi.arch import ( diff --git a/tests/test_arguments.py b/tests/test_arguments.py index 20bf17ed..b67fdc4b 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -1,4 +1,7 @@ -import mock +try: + from unittest import mock +except ImportError: + import mock try: import unittest2 as unittest diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index b92abe11..28a169b6 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -6,7 +6,10 @@ try: except ImportError: import unittest -import mock +try: + from unittest import mock +except ImportError: + import mock import six from copy import copy from six.moves import StringIO diff --git a/tests/test_checks.py b/tests/test_checks.py index 9d53b119..864da165 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock try: import unittest2 as unittest diff --git a/tests/test_compose.py b/tests/test_compose.py index 246acc65..da66e766 100644 --- a/tests/test_compose.py +++ b/tests/test_compose.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- import logging -import mock + +try: + from unittest import mock +except ImportError: + import mock try: import unittest2 as unittest diff --git a/tests/test_config.py b/tests/test_config.py index 6de64ef0..a12dccf5 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -7,7 +7,11 @@ except ImportError: import unittest import six -import mock + +try: + from unittest import mock +except ImportError: + import mock from pungi import checks from tests.helpers import load_config, PKGSET_REPOS diff --git a/tests/test_config_validate_script.py b/tests/test_config_validate_script.py index 4f9c64bf..b6dcf38a 100644 --- a/tests/test_config_validate_script.py +++ b/tests/test_config_validate_script.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- - -import mock +try: + from unittest import mock +except ImportError: + import mock import os import six diff --git a/tests/test_createiso_phase.py b/tests/test_createiso_phase.py index 5cd21ad2..02ff8c90 100644 --- a/tests/test_createiso_phase.py +++ b/tests/test_createiso_phase.py @@ -2,7 +2,11 @@ import logging -import mock + +try: + from unittest import mock +except ImportError: + import mock import six import os diff --git a/tests/test_createiso_script.py b/tests/test_createiso_script.py index 3c62e15d..87080e10 100644 --- a/tests/test_createiso_script.py +++ b/tests/test_createiso_script.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock from parameterized import parameterized import os diff --git a/tests/test_createrepophase.py b/tests/test_createrepophase.py index aecff998..11d641b1 100644 --- a/tests/test_createrepophase.py +++ b/tests/test_createrepophase.py @@ -8,7 +8,10 @@ except ImportError: import glob import os -import mock +try: + from unittest import mock +except ImportError: + import mock import six from pungi.module_util import Modulemd diff --git a/tests/test_extra_files_phase.py b/tests/test_extra_files_phase.py index 21dc3feb..30675eaf 100644 --- a/tests/test_extra_files_phase.py +++ b/tests/test_extra_files_phase.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os from productmd.extra_files import ExtraFiles diff --git a/tests/test_extra_isos_phase.py b/tests/test_extra_isos_phase.py index 50cfa6c9..9d60eee3 100644 --- a/tests/test_extra_isos_phase.py +++ b/tests/test_extra_isos_phase.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- import logging -import mock + +try: + from unittest import mock +except ImportError: + import mock import six import os diff --git a/tests/test_gather_method_deps.py b/tests/test_gather_method_deps.py index 77b30bcd..2c77845f 100644 --- a/tests/test_gather_method_deps.py +++ b/tests/test_gather_method_deps.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock from pungi.phases.gather.methods import method_deps as deps from tests import helpers diff --git a/tests/test_gather_method_hybrid.py b/tests/test_gather_method_hybrid.py index b053f229..91ca86c0 100644 --- a/tests/test_gather_method_hybrid.py +++ b/tests/test_gather_method_hybrid.py @@ -2,7 +2,11 @@ from collections import namedtuple import copy -import mock + +try: + from unittest import mock +except ImportError: + import mock import os import six diff --git a/tests/test_gather_method_nodeps.py b/tests/test_gather_method_nodeps.py index b337fe96..eecdb5f3 100644 --- a/tests/test_gather_method_nodeps.py +++ b/tests/test_gather_method_nodeps.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os import six diff --git a/tests/test_gather_phase.py b/tests/test_gather_phase.py index c5a33a7e..5bc6ec8d 100644 --- a/tests/test_gather_phase.py +++ b/tests/test_gather_phase.py @@ -4,7 +4,10 @@ import copy import json import os -import mock +try: + from unittest import mock +except ImportError: + import mock try: import unittest2 as unittest diff --git a/tests/test_gather_source_module.py b/tests/test_gather_source_module.py index 7b87400a..e5f0d376 100644 --- a/tests/test_gather_source_module.py +++ b/tests/test_gather_source_module.py @@ -5,7 +5,10 @@ try: except ImportError: import unittest -import mock +try: + from unittest import mock +except ImportError: + import mock import six from pungi.phases.gather.sources.source_module import GatherSourceModule diff --git a/tests/test_image_container_phase.py b/tests/test_image_container_phase.py index 246bb267..a467ef7c 100644 --- a/tests/test_image_container_phase.py +++ b/tests/test_image_container_phase.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py index f62aa3f9..90f10ef5 100644 --- a/tests/test_imagebuildphase.py +++ b/tests/test_imagebuildphase.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import six diff --git a/tests/test_imagechecksumphase.py b/tests/test_imagechecksumphase.py index fd8a44cb..d5193849 100644 --- a/tests/test_imagechecksumphase.py +++ b/tests/test_imagechecksumphase.py @@ -4,7 +4,10 @@ try: import unittest2 as unittest except ImportError: import unittest -import mock +try: + from unittest import mock +except ImportError: + import mock import os import tempfile diff --git a/tests/test_initphase.py b/tests/test_initphase.py index 2ddb82ca..1fb1c105 100644 --- a/tests/test_initphase.py +++ b/tests/test_initphase.py @@ -5,7 +5,10 @@ try: import unittest2 as unittest except ImportError: import unittest -import mock +try: + from unittest import mock +except ImportError: + import mock import six diff --git a/tests/test_iso_wrapper.py b/tests/test_iso_wrapper.py index bdea5dd5..8338007f 100644 --- a/tests/test_iso_wrapper.py +++ b/tests/test_iso_wrapper.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- import itertools -import mock + +try: + from unittest import mock +except ImportError: + import mock import os import six diff --git a/tests/test_koji_wrapper.py b/tests/test_koji_wrapper.py index 341090f5..e203d5e3 100644 --- a/tests/test_koji_wrapper.py +++ b/tests/test_koji_wrapper.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- import json -import mock + +try: + from unittest import mock +except ImportError: + import mock try: import unittest2 as unittest diff --git a/tests/test_linker.py b/tests/test_linker.py index e81ca2f2..bf1a36b1 100644 --- a/tests/test_linker.py +++ b/tests/test_linker.py @@ -1,7 +1,10 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import errno import os import stat diff --git a/tests/test_liveimagesphase.py b/tests/test_liveimagesphase.py index af7327ad..10fe06ea 100644 --- a/tests/test_liveimagesphase.py +++ b/tests/test_liveimagesphase.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- - -import mock +try: + from unittest import mock +except ImportError: + import mock import six diff --git a/tests/test_livemediaphase.py b/tests/test_livemediaphase.py index c4161361..ad7e6939 100644 --- a/tests/test_livemediaphase.py +++ b/tests/test_livemediaphase.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os diff --git a/tests/test_media_split.py b/tests/test_media_split.py index f286f658..a8f2d971 100644 --- a/tests/test_media_split.py +++ b/tests/test_media_split.py @@ -4,7 +4,10 @@ try: import unittest2 as unittest except ImportError: import unittest -import mock +try: + from unittest import mock +except ImportError: + import mock from pungi import media_split diff --git a/tests/test_metadata.py b/tests/test_metadata.py index a5fa10a2..366b90e4 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -1,4 +1,7 @@ -import mock +try: + from unittest import mock +except ImportError: + import mock import os import six diff --git a/tests/test_notifier.py b/tests/test_notifier.py index 2273add2..41c2c28a 100644 --- a/tests/test_notifier.py +++ b/tests/test_notifier.py @@ -2,7 +2,11 @@ from datetime import datetime import json -import mock + +try: + from unittest import mock +except ImportError: + import mock try: import unittest2 as unittest diff --git a/tests/test_osbs_phase.py b/tests/test_osbs_phase.py index 5df69091..12847d7d 100644 --- a/tests/test_osbs_phase.py +++ b/tests/test_osbs_phase.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import json import copy diff --git a/tests/test_osbuild_phase.py b/tests/test_osbuild_phase.py index c337b60e..c2309118 100644 --- a/tests/test_osbuild_phase.py +++ b/tests/test_osbuild_phase.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os import shutil diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py index 1dcacd85..695277c5 100644 --- a/tests/test_ostree_installer_phase.py +++ b/tests/test_ostree_installer_phase.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os diff --git a/tests/test_ostree_phase.py b/tests/test_ostree_phase.py index 44c623a1..96b4aaae 100644 --- a/tests/test_ostree_phase.py +++ b/tests/test_ostree_phase.py @@ -2,7 +2,11 @@ import json -import mock + +try: + from unittest import mock +except ImportError: + import mock import os diff --git a/tests/test_ostree_script.py b/tests/test_ostree_script.py index eab84158..76381b70 100644 --- a/tests/test_ostree_script.py +++ b/tests/test_ostree_script.py @@ -4,7 +4,10 @@ import json import os -import mock +try: + from unittest import mock +except ImportError: + import mock import six import yaml diff --git a/tests/test_ostree_utils.py b/tests/test_ostree_utils.py index 76541017..4f9246f4 100644 --- a/tests/test_ostree_utils.py +++ b/tests/test_ostree_utils.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os diff --git a/tests/test_patch_iso.py b/tests/test_patch_iso.py index 9fe8d7b4..addf523e 100644 --- a/tests/test_patch_iso.py +++ b/tests/test_patch_iso.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os try: diff --git a/tests/test_phase_base.py b/tests/test_phase_base.py index 5a45df39..f2719b12 100644 --- a/tests/test_phase_base.py +++ b/tests/test_phase_base.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock try: import unittest2 as unittest diff --git a/tests/test_pkgset_common.py b/tests/test_pkgset_common.py index 96f6312d..3b0520fc 100755 --- a/tests/test_pkgset_common.py +++ b/tests/test_pkgset_common.py @@ -2,7 +2,10 @@ import os -import mock +try: + from unittest import mock +except ImportError: + import mock import six from pungi.module_util import Modulemd diff --git a/tests/test_pkgset_pkgsets.py b/tests/test_pkgset_pkgsets.py index 0c1256d7..823cdd3e 100644 --- a/tests/test_pkgset_pkgsets.py +++ b/tests/test_pkgset_pkgsets.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os import six diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index 19e82e15..1bff7f34 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- import json -import mock + +try: + from unittest import mock +except ImportError: + import mock import os import re import six diff --git a/tests/test_repoclosure_phase.py b/tests/test_repoclosure_phase.py index 81e4bb5b..9937e6aa 100644 --- a/tests/test_repoclosure_phase.py +++ b/tests/test_repoclosure_phase.py @@ -6,7 +6,10 @@ try: except ImportError: import unittest -import mock +try: + from unittest import mock +except ImportError: + import mock import six import pungi.phases.repoclosure as repoclosure_phase diff --git a/tests/test_runroot.py b/tests/test_runroot.py index d2b7e014..18a12684 100644 --- a/tests/test_runroot.py +++ b/tests/test_runroot.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os from pungi.runroot import Runroot diff --git a/tests/test_scm.py b/tests/test_scm.py index c96d94fc..d6b50a8d 100644 --- a/tests/test_scm.py +++ b/tests/test_scm.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock try: import unittest2 as unittest diff --git a/tests/test_test_phase.py b/tests/test_test_phase.py index 1b6f1ad1..1aa3b609 100644 --- a/tests/test_test_phase.py +++ b/tests/test_test_phase.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os import pungi.phases.test as test_phase diff --git a/tests/test_unified_isos.py b/tests/test_unified_isos.py index 4047e5d5..c09edf54 100755 --- a/tests/test_unified_isos.py +++ b/tests/test_unified_isos.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -import mock +try: + from unittest import mock +except ImportError: + import mock import os import shutil import six diff --git a/tests/test_util.py b/tests/test_util.py index c22e10f7..afda1e55 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- import argparse -import mock + +try: + from unittest import mock +except ImportError: + import mock import os try: