Use mock in a Python 3.4 compatible way
Related to https://code.google.com/p/mock/issues/detail?id=234 Change-Id: I85549fdba7b9cb575850a12d52e1ffb0d2dba8c0
This commit is contained in:
parent
7ba4f6060c
commit
fbd432a0ad
@ -27,6 +27,12 @@ import operator
|
||||
import testtools
|
||||
import xml.etree.ElementTree as XML
|
||||
from six.moves import configparser
|
||||
# This dance deals with the fact that we want unittest.mock if
|
||||
# we're on Python 3.4 and later, and non-stdlib mock otherwise.
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock # noqa
|
||||
import jenkins_jobs.local_yaml as yaml
|
||||
from jenkins_jobs.builder import XmlJob, YamlParser, ModuleRegistry
|
||||
from jenkins_jobs.modules import (project_flow,
|
||||
|
@ -13,10 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
import jenkins_jobs
|
||||
from tests.base import mock
|
||||
|
||||
|
||||
class TestCaseCacheStorage(testtools.TestCase):
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
import mock
|
||||
from jenkins_jobs import cmd
|
||||
from tests.base import mock
|
||||
from tests.cmd.test_cmd import CmdTestsBase
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import os
|
||||
import io
|
||||
import codecs
|
||||
import mock
|
||||
from jenkins_jobs import cmd
|
||||
from tests.base import mock
|
||||
from tests.cmd.test_cmd import CmdTestsBase
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import os
|
||||
from six.moves import configparser, StringIO
|
||||
import mock
|
||||
import testtools
|
||||
from jenkins_jobs import cmd
|
||||
from tests.base import mock
|
||||
|
||||
|
||||
class CmdTestsBase(testtools.TestCase):
|
||||
|
@ -14,11 +14,14 @@
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import mock
|
||||
|
||||
from testtools import TestCase, ExpectedException
|
||||
from testscenarios.testcase import TestWithScenarios
|
||||
from tests.base import get_scenarios, SingleJobTestCase
|
||||
|
||||
from jenkins_jobs.errors import JenkinsJobsException
|
||||
from tests.base import SingleJobTestCase
|
||||
from tests.base import get_scenarios
|
||||
from tests.base import mock
|
||||
|
||||
|
||||
class TestCaseModuleDuplicates(TestWithScenarios, TestCase,
|
||||
|
Loading…
Reference in New Issue
Block a user