Skip to content

Commit d4edf89

Browse files
authored
Removed external mock dependency (#211)
1 parent c79f527 commit d4edf89

File tree

9 files changed

+18
-20
lines changed

9 files changed

+18
-20
lines changed

vos/setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ test =
6161
pytest>=4.6
6262
pytest-cov>=2.5.1
6363
flake8>=3.4.1
64-
mock>=2.0.0
6564

6665

6766
[entry_points]

vos/vos/commands/tests/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
33
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
44
#
5-
# (c) 2022. (c) 2022.
5+
# (c) 2023. (c) 2023.
66
# Government of Canada Gouvernement du Canada
77
# National Research Council Conseil national de recherches
88
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
@@ -70,7 +70,7 @@
7070
import os
7171
import unittest
7272
from io import StringIO
73-
from mock import Mock, patch
73+
from unittest.mock import Mock, patch
7474
from vos import commands as cmds
7575

7676
THIS_DIR = os.path.dirname(os.path.realpath(__file__))

vos/vos/commands/tests/test_vls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
33
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
44
#
5-
# (c) 2022. (c) 2022.
5+
# (c) 2023. (c) 2023.
66
# Government of Canada Gouvernement du Canada
77
# National Research Council Conseil national de recherches
88
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
@@ -70,7 +70,7 @@
7070
import unittest
7171

7272
from io import StringIO
73-
from mock import Mock, patch, MagicMock, call
73+
from unittest.mock import Mock, patch, MagicMock, call
7474
from vos import commands
7575

7676
# the following is a temporary workaround for python issue

vos/vos/commands/tests/test_vsync.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
33
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
44
#
5-
# (c) 2022. (c) 2022.
5+
# (c) 2023. (c) 2023.
66
# Government of Canada Gouvernement du Canada
77
# National Research Council Conseil national de recherches
88
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
@@ -71,8 +71,7 @@
7171
import importlib
7272
import datetime
7373
import pytest
74-
import mock
75-
from mock import Mock
74+
from unittest.mock import Mock, patch
7675
import hashlib
7776

7877
from vos.commands.vsync import validate, prepare, build_file_list, execute, \
@@ -98,15 +97,15 @@ def module_patch(*args):
9897
imported = importlib.import_module('.'.join(components[:i]))
9998

10099
# module was imported, let's use it in the patch
101-
result = mock.patch(*args)
100+
result = patch(*args)
102101
result.getter = lambda: imported
103102
result.attribute = '.'.join(components[i:])
104103
return result
105104
except Exception:
106105
pass
107106

108107
# did not find a module, just return the default mock
109-
return mock.patch(*args)
108+
return patch(*args)
110109

111110

112111
def test_compute_md5():

vos/vos/tests/test_commonparser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
33
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
44
#
5-
# (c) 2022. (c) 2022.
5+
# (c) 2023. (c) 2023.
66
# Government of Canada Gouvernement du Canada
77
# National Research Council Conseil national de recherches
88
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
@@ -72,7 +72,7 @@
7272
from vos.commonparser import CommonParser
7373
from vos.commonparser import set_logging_level_from_args, exit_on_exception
7474
from vos.version import version
75-
from mock import patch, Mock
75+
from unittest.mock import patch, Mock
7676
from io import StringIO
7777

7878

vos/vos/tests/test_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
33
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
44
#
5-
# (c) 2022. (c) 2022.
5+
# (c) 2023. (c) 2023.
66
# Government of Canada Gouvernement du Canada
77
# National Research Council Conseil national de recherches
88
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
@@ -67,7 +67,7 @@
6767
#
6868

6969
# Test the vosconfig functionality
70-
from mock import Mock, patch
70+
from unittest.mock import Mock, patch
7171
import warnings
7272

7373
from vos import vosconfig, Connection

vos/vos/tests/test_md5_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
33
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
44
#
5-
# (c) 2022. (c) 2022.
5+
# (c) 2023. (c) 2023.
66
# Government of Canada Gouvernement du Canada
77
# National Research Council Conseil national de recherches
88
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
@@ -72,7 +72,7 @@
7272
import hashlib
7373

7474
from vos.md5_cache import MD5Cache
75-
from mock import patch, MagicMock, call, mock_open
75+
from unittest.mock import patch, MagicMock, call, mock_open
7676

7777
# The following is a temporary workaround for Python issue 25532
7878
# (https://bugs.python.org/issue25532)

vos/vos/tests/test_vofile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
33
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
44
#
5-
# (c) 2022. (c) 2022.
5+
# (c) 2023. (c) 2023.
66
# Government of Canada Gouvernement du Canada
77
# National Research Council Conseil national de recherches
88
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
@@ -70,7 +70,7 @@
7070
import builtins
7171
import requests
7272
import unittest
73-
from mock import Mock, MagicMock, patch
73+
from unittest.mock import Mock, MagicMock, patch
7474
import os
7575

7676
from vos import vos, Connection, vosconfig

vos/vos/tests/test_vos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
33
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
44
#
5-
# (c) 2022. (c) 2022.
5+
# (c) 2023. (c) 2023.
66
# Government of Canada Gouvernement du Canada
77
# National Research Council Conseil national de recherches
88
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
@@ -73,7 +73,7 @@
7373
import pytest
7474
import requests
7575
from xml.etree import ElementTree
76-
from mock import Mock, patch, MagicMock, call
76+
from unittest.mock import Mock, patch, MagicMock, call
7777
from vos import Client, Connection, Node, VOFile, vosconfig
7878
from vos import vos as vos
7979
from urllib.parse import urlparse, unquote

0 commit comments

Comments
 (0)