From 812dc9be341b69394502e3a7422fb6a3d3ce1423 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 20 Jan 2016 15:17:34 +0100 Subject: testsuite: Newer version of mock require different imports Be flexible and support the imports required by newer versions of the mock package (>1.1.0). Because this new version is not available on all distributions we are flexible and also support the old style. --- testsuite/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'testsuite/common.py') diff --git a/testsuite/common.py b/testsuite/common.py index 9f51cc14f..396f1887b 100644 --- a/testsuite/common.py +++ b/testsuite/common.py @@ -15,7 +15,10 @@ import codecs import lxml.etree import Bcfg2.Options import Bcfg2.Utils -from mock import patch, MagicMock, _patch, DEFAULT +try: + from mock.mock import patch, MagicMock, _patch, DEFAULT +except ImportError: + from mock import patch, MagicMock, _patch, DEFAULT try: from unittest2 import skip, skipIf, skipUnless, TestCase except ImportError: -- cgit v1.2.3-1-g7c22