Make test_notifier independent of test case execution order

Test_notifier contains a test case that verifies default notifier value
(test_get_default_notifier) and there are 2 test cases that update
default notifier value. It's supposed that test_get_default_notifier
is executed first, otherwise it gets wrong value. Test's tearDown()
method was designed to restore default notifier, but failed to do so
due to wrong reference to global variable.

Change-Id: Id083f1e8ba4bf2a0341eb1a7ee8891b53c1f3a65
This commit is contained in:
Ilya Shakhat 2017-08-10 14:16:01 +02:00
parent 88c1e8b9d3
commit 17f8441e28

View File

@ -22,7 +22,7 @@ from osprofiler.tests import test
class NotifierTestCase(test.TestCase): class NotifierTestCase(test.TestCase):
def tearDown(self): def tearDown(self):
notifier.__notifier = notifier._noop_notifier notifier.set(notifier._noop_notifier) # restore defaults
super(NotifierTestCase, self).tearDown() super(NotifierTestCase, self).tearDown()
def test_set(self): def test_set(self):