diff --git a/certbot/plugins/util_test.py b/certbot/plugins/util_test.py index e1a064fb3..63a472fa0 100644 --- a/certbot/plugins/util_test.py +++ b/certbot/plugins/util_test.py @@ -4,13 +4,7 @@ import unittest import sys import mock - -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 +from six.moves import reload_module # pylint: disable=import-error class PathSurgeryTest(unittest.TestCase): @@ -50,14 +44,14 @@ class AlreadyListeningTestNoPsutil(unittest.TestCase): sys.modules['psutil'] = None # Reload hackery to ensure getting non-psutil version # loaded to memory - refresh(certbot.plugins.util) + reload_module(certbot.plugins.util) def tearDown(self): # Need to reload the module to ensure # getting back to normal import certbot.plugins.util sys.modules["psutil"] = self.psutil - refresh(certbot.plugins.util) + reload_module(certbot.plugins.util) @mock.patch("certbot.plugins.util.zope.component.getUtility") def test_ports_available(self, mock_getutil):