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:
Jeremy Stanley 2015-01-29 21:36:51 +00:00
parent 7ba4f6060c
commit fbd432a0ad
6 changed files with 15 additions and 6 deletions

View File

@ -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,

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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,