Stop reloading swift.common.utils in test_daemon
This was causing some headaches over on feature/deep where a __eq__ wasn't working as expected because neither self nor other was an instance of the class we thought we were using. Apparently, this also fixes some issues when using fake_syslog = True? There are two other places that we use reload_module, in test_db_replicator and test_manager, but the monkey patching isn't nearly as straight-forward. Change-Id: I94d6578e275219e9687fee2f0c7cc4f99454b77f Related-Bug: 1704192
This commit is contained in:
parent
5ff847ae26
commit
cc17c99e73
@ -15,7 +15,6 @@
|
||||
|
||||
import os
|
||||
from six import StringIO
|
||||
from six.moves import reload_module
|
||||
import time
|
||||
import unittest
|
||||
from getpass import getuser
|
||||
@ -102,13 +101,14 @@ class TestWorkerDaemon(unittest.TestCase):
|
||||
class TestRunDaemon(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
utils.HASH_PATH_SUFFIX = 'endcap'
|
||||
utils.HASH_PATH_PREFIX = 'startcap'
|
||||
utils.drop_privileges = lambda *args: None
|
||||
utils.capture_stdio = lambda *args: None
|
||||
|
||||
def tearDown(self):
|
||||
reload_module(utils)
|
||||
for patcher in [
|
||||
mock.patch.object(utils, 'HASH_PATH_PREFIX', 'startcap'),
|
||||
mock.patch.object(utils, 'HASH_PATH_SUFFIX', 'endcap'),
|
||||
mock.patch.object(utils, 'drop_privileges', lambda *args: None),
|
||||
mock.patch.object(utils, 'capture_stdio', lambda *args: None),
|
||||
]:
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
|
||||
def test_run(self):
|
||||
d = MyDaemon({})
|
||||
|
Loading…
x
Reference in New Issue
Block a user