Cross-version mock import

This commit is contained in:
amercader 2022-07-14 14:00:52 +02:00
parent b92b364bd9
commit 7b6097ad98
3 changed files with 13 additions and 3 deletions

View File

@ -1,7 +1,11 @@
import re
import pytest
from mock import patch
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from ckanext.harvest.harvesters.base import HarvesterBase, munge_tag
from ckantoolkit.tests import factories

View File

@ -2,7 +2,10 @@ from __future__ import absolute_import
import copy
import json
from mock import patch, MagicMock, Mock
try:
from unittest.mock import patch, MagicMock, Mock
except ImportError:
from mock import patch, MagicMock, Mock
import pytest
from requests.exceptions import HTTPError, RequestException

View File

@ -1,5 +1,8 @@
import pytest
from mock import patch
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from ckanext.harvest.model import HarvestObject, HarvestObjectExtra
from ckanext.harvest.interfaces import IHarvester