Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated mock to built-in unittest.mock #1311

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions development.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
-r requirements.txt

coverage # http://nedbatchelder.com/code/coverage/
mock # http://www.voidspace.org.uk/python/mock/
nose2 # https://docs.nose2.io/en/latest/
pep8 # https://github.com/jcrocholl/pep8
pyflakes # https://launchpad.net/pyflakes
coveralls # https://coveralls.io/
ntc_templates # user needs to explicitly install this
cryptography==3.2
cryptography==3.2
2 changes: 1 addition & 1 deletion tests/unit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys

import nose2
from mock import patch
from unittest.mock import patch

__author__ = "Nitin Kumar"
__credits__ = "Jeremy Schulman"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/factory/test_cfgtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ncclient.manager import Manager, make_device_handler
from ncclient.transport import SSHSession
from lxml import etree
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch

from jnpr.junos.factory import loadyaml
from jnpr.junos.factory.factory_loader import FactoryLoader
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/factory/test_cmdtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from ncclient.manager import Manager, make_device_handler
from ncclient.transport import SSHSession
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch
import yamlordereddictloader
from jnpr.junos.factory.factory_loader import FactoryLoader
import yaml
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/factory/test_factory_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest
import nose2
from jnpr.junos.factory import FactoryLoader
from mock import patch
from unittest.mock import patch


class TestFactoryLoader(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/factory/test_optable.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from lxml import etree

from mock import patch
from unittest.mock import patch


class TestFactoryOpTable(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/factory/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from jnpr.junos import Device
from jnpr.junos.factory.table import Table

from mock import patch
from unittest.mock import patch
from lxml import etree
from jnpr.junos.op.phyport import PhyPortTable

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/factory/test_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
except ImportError:
import unittest
import nose2
from mock import patch
from unittest.mock import patch
import os
import json

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/factory/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch
from jnpr.junos import Device
from jnpr.junos.factory.view import View
from jnpr.junos.op.phyport import PhyPortStatsTable, PhyPortStatsView
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_current_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
from lxml import etree

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
from lxml import etree

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_ethernet_mac_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
from lxml import etree

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_file_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_get_chassis_cluster_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
from lxml import etree

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_get_chassis_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_get_route_engine_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
from lxml import etree

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_get_software_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
from lxml import etree

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_get_virtual_chassis_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
import sys
from lxml import etree
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_ifd_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
from lxml import etree

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_iri_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/facts/test_personality.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
from jnpr.junos.exception import RpcError

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ofacts/test_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
from lxml import etree
import os

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ofacts/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
from lxml import etree

from jnpr.junos.ofacts.domain import facts_domain
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ofacts/test_ifd_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman"

import unittest
from mock import patch
from unittest.mock import patch
import nose2

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ofacts/test_personality.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman"

import unittest
from mock import patch
from unittest.mock import patch
import nose2

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ofacts/test_routing_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os
import sys

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ofacts/test_srx_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
import nose2
from mock import patch
from unittest.mock import patch
import os

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ofacts/test_switch_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__credits__ = "Jeremy Schulman"

import unittest
from mock import patch
from unittest.mock import patch
import nose2

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ofacts/test_swver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
except ImportError:
import unittest
import nose2
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
import os

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest
from jnpr.junos.utils.config import Config
import nose2
from mock import patch, MagicMock, call
from unittest.mock import patch, MagicMock, call
import re
import sys
import os
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from jnpr.junos.decorators import timeoutDecorator, normalizeDecorator
from jnpr.junos.decorators import ignoreWarnDecorator

from mock import patch, MagicMock, PropertyMock, call
from unittest.mock import patch, MagicMock, PropertyMock, call

from ncclient.operations.rpc import RPCError
from ncclient.manager import Manager, make_device_handler
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
except ImportError:
import unittest
import nose2
from mock import MagicMock, patch, mock_open, call
from unittest.mock import MagicMock, patch, mock_open, call
import os
from lxml import etree
import sys
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_factcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
except ImportError:
import unittest
import nose2
from mock import patch, MagicMock, call
from unittest.mock import patch, MagicMock, call
from jnpr.junos.exception import FactLoopError

from jnpr.junos import Device
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys

import nose2
from mock import patch
from unittest.mock import patch

__author__ = "Nitin Kumar"
__credits__ = "Jeremy Schulman"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_jxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest
from io import StringIO
import nose2
from mock import patch
from unittest.mock import patch
from jnpr.junos.jxml import (
NAME,
INSERT,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_rpcmeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ncclient.transport import SSHSession
from jnpr.junos.exception import JSONLoadError

from mock import patch, MagicMock, call
from unittest.mock import patch, MagicMock, call
from lxml import etree

__author__ = "Nitin Kumar, Rick Sherman"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/transport/test_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
except ImportError:
import unittest
import nose2
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch
import sys
import six

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/transport/test_tty.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest

import nose2
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch

from jnpr.junos.transport.tty import Terminal
from jnpr.junos import exception as EzErrors
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/transport/test_tty_netconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
except ImportError:
import unittest
import nose2
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch

from jnpr.junos.transport.tty_netconf import tty_netconf

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/transport/test_tty_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
except ImportError:
import unittest
import nose2
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch
from jnpr.junos.transport.tty_ssh import SSH


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/transport/test_tty_telnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
except ImportError:
import unittest
import nose2
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch
from jnpr.junos.transport.tty_telnet import Telnet
import six

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/utils/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ncclient.transport import SSHSession
from ncclient.operations import RPCError, RPCReply

from mock import MagicMock, patch
from unittest.mock import MagicMock, patch
from lxml import etree
import os

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/utils/test_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from jnpr.junos.utils.fs import FS
from jnpr.junos.exception import RpcError

from mock import patch, MagicMock, call
from unittest.mock import patch, MagicMock, call
from lxml import etree

__author__ = "Nitin Kumar, Rick Sherman"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/utils/test_ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from jnpr.junos import Device
import jnpr.junos.utils.ftp

from mock import patch
from unittest.mock import patch

if sys.version < "3":
builtin_string = "__builtin__"
Expand Down
Loading
Loading