Skip to content

Commit

Permalink
Removed external mock dependency (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
andamian authored Jan 11, 2023
1 parent c79f527 commit d4edf89
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 20 deletions.
1 change: 0 additions & 1 deletion vos/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ test =
pytest>=4.6
pytest-cov>=2.5.1
flake8>=3.4.1
mock>=2.0.0


[entry_points]
Expand Down
4 changes: 2 additions & 2 deletions vos/vos/commands/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2023. (c) 2023.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -70,7 +70,7 @@
import os
import unittest
from io import StringIO
from mock import Mock, patch
from unittest.mock import Mock, patch
from vos import commands as cmds

THIS_DIR = os.path.dirname(os.path.realpath(__file__))
Expand Down
4 changes: 2 additions & 2 deletions vos/vos/commands/tests/test_vls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2023. (c) 2023.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -70,7 +70,7 @@
import unittest

from io import StringIO
from mock import Mock, patch, MagicMock, call
from unittest.mock import Mock, patch, MagicMock, call
from vos import commands

# the following is a temporary workaround for python issue
Expand Down
9 changes: 4 additions & 5 deletions vos/vos/commands/tests/test_vsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2023. (c) 2023.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -71,8 +71,7 @@
import importlib
import datetime
import pytest
import mock
from mock import Mock
from unittest.mock import Mock, patch
import hashlib

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

# module was imported, let's use it in the patch
result = mock.patch(*args)
result = patch(*args)
result.getter = lambda: imported
result.attribute = '.'.join(components[i:])
return result
except Exception:
pass

# did not find a module, just return the default mock
return mock.patch(*args)
return patch(*args)


def test_compute_md5():
Expand Down
4 changes: 2 additions & 2 deletions vos/vos/tests/test_commonparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2023. (c) 2023.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -72,7 +72,7 @@
from vos.commonparser import CommonParser
from vos.commonparser import set_logging_level_from_args, exit_on_exception
from vos.version import version
from mock import patch, Mock
from unittest.mock import patch, Mock
from io import StringIO


Expand Down
4 changes: 2 additions & 2 deletions vos/vos/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2023. (c) 2023.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -67,7 +67,7 @@
#

# Test the vosconfig functionality
from mock import Mock, patch
from unittest.mock import Mock, patch
import warnings

from vos import vosconfig, Connection
Expand Down
4 changes: 2 additions & 2 deletions vos/vos/tests/test_md5_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2023. (c) 2023.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -72,7 +72,7 @@
import hashlib

from vos.md5_cache import MD5Cache
from mock import patch, MagicMock, call, mock_open
from unittest.mock import patch, MagicMock, call, mock_open

# The following is a temporary workaround for Python issue 25532
# (https://bugs.python.org/issue25532)
Expand Down
4 changes: 2 additions & 2 deletions vos/vos/tests/test_vofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2023. (c) 2023.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -70,7 +70,7 @@
import builtins
import requests
import unittest
from mock import Mock, MagicMock, patch
from unittest.mock import Mock, MagicMock, patch
import os

from vos import vos, Connection, vosconfig
Expand Down
4 changes: 2 additions & 2 deletions vos/vos/tests/test_vos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2023. (c) 2023.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -73,7 +73,7 @@
import pytest
import requests
from xml.etree import ElementTree
from mock import Mock, patch, MagicMock, call
from unittest.mock import Mock, patch, MagicMock, call
from vos import Client, Connection, Node, VOFile, vosconfig
from vos import vos as vos
from urllib.parse import urlparse, unquote
Expand Down

0 comments on commit d4edf89

Please sign in to comment.