Replace external mock with built-in unittest.mock

Now that stevedore does not support Python 2 anymore, there is no need
to ever use the external 'mock' package.  Python 3.3+ has it integrated
as 'unittest.mock', so just use that.

Change-Id: I28a50cac12670bb6987b4c7794a15e15aa1fe965
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny 2020-06-05 07:50:39 +02:00
parent 0c10f5cf21
commit 34b9a13049
8 changed files with 10 additions and 10 deletions

View File

@ -6,7 +6,7 @@ python:
- "pypy" - "pypy"
install: install:
- pip install flake8 --use-mirrors - pip install flake8 --use-mirrors
- pip install nose mock --use-mirrors - pip install nose --use-mirrors
- pip install -q . --use-mirrors - pip install -q . --use-mirrors
before_script: before_script:
- flake8 stevedore setup.py - flake8 stevedore setup.py

View File

@ -11,7 +11,6 @@ imagesize==0.7.1
Jinja2==2.10 Jinja2==2.10
linecache2==1.0.0 linecache2==1.0.0
MarkupSafe==1.0 MarkupSafe==1.0
mock==2.0.0
pbr==2.0.0 pbr==2.0.0
Pygments==2.2.0 Pygments==2.2.0
python-mimeparse==1.6.0 python-mimeparse==1.6.0

View File

@ -12,8 +12,9 @@
"""Tests for failure loading callback """Tests for failure loading callback
""" """
from unittest import mock
from testtools.matchers import GreaterThan from testtools.matchers import GreaterThan
import mock
from stevedore import extension from stevedore import extension
from stevedore import named from stevedore import named

View File

@ -14,8 +14,7 @@
""" """
import operator import operator
from unittest import mock
import mock
from stevedore import exception from stevedore import exception
from stevedore import extension from stevedore import extension

View File

@ -10,11 +10,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
from stevedore import named from stevedore import named
from stevedore.tests import utils from stevedore.tests import utils
import mock
class TestNamed(utils.TestCase): class TestNamed(utils.TestCase):
def test_named(self): def test_named(self):

View File

@ -12,11 +12,12 @@
"""Tests for the sphinx extension """Tests for the sphinx extension
""" """
from unittest import mock
from stevedore import extension from stevedore import extension
from stevedore import sphinxext from stevedore import sphinxext
from stevedore.tests import utils from stevedore.tests import utils
import mock
import pkg_resources import pkg_resources

View File

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from mock import Mock, sentinel from unittest.mock import Mock, sentinel
from stevedore import (ExtensionManager, NamedExtensionManager, HookManager, from stevedore import (ExtensionManager, NamedExtensionManager, HookManager,
DriverManager, EnabledExtensionManager) DriverManager, EnabledExtensionManager)
from stevedore.dispatch import (DispatchExtensionManager, from stevedore.dispatch import (DispatchExtensionManager,

View File

@ -2,7 +2,6 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
mock>=2.0.0 # BSD
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0
# sphinx is needed for testing the sphinxext module # sphinx is needed for testing the sphinxext module