mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:41:53 +02:00
use six instead of custom refresh function
This commit is contained in:
@@ -4,13 +4,7 @@ import unittest
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from six.moves import reload_module # pylint: disable=import-error
|
||||||
try:
|
|
||||||
# Python 3.5+
|
|
||||||
from importlib import reload as refresh # pylint: disable=no-name-in-module
|
|
||||||
except ImportError:
|
|
||||||
# Python 2-3.4
|
|
||||||
from imp import reload as refresh
|
|
||||||
|
|
||||||
|
|
||||||
class PathSurgeryTest(unittest.TestCase):
|
class PathSurgeryTest(unittest.TestCase):
|
||||||
@@ -50,14 +44,14 @@ class AlreadyListeningTestNoPsutil(unittest.TestCase):
|
|||||||
sys.modules['psutil'] = None
|
sys.modules['psutil'] = None
|
||||||
# Reload hackery to ensure getting non-psutil version
|
# Reload hackery to ensure getting non-psutil version
|
||||||
# loaded to memory
|
# loaded to memory
|
||||||
refresh(certbot.plugins.util)
|
reload_module(certbot.plugins.util)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# Need to reload the module to ensure
|
# Need to reload the module to ensure
|
||||||
# getting back to normal
|
# getting back to normal
|
||||||
import certbot.plugins.util
|
import certbot.plugins.util
|
||||||
sys.modules["psutil"] = self.psutil
|
sys.modules["psutil"] = self.psutil
|
||||||
refresh(certbot.plugins.util)
|
reload_module(certbot.plugins.util)
|
||||||
|
|
||||||
@mock.patch("certbot.plugins.util.zope.component.getUtility")
|
@mock.patch("certbot.plugins.util.zope.component.getUtility")
|
||||||
def test_ports_available(self, mock_getutil):
|
def test_ports_available(self, mock_getutil):
|
||||||
|
|||||||
Reference in New Issue
Block a user