Reset the _TRAITS_SYNCED global in Traits tests

The global is reset before and after tests because we don't know
what other tests might have been messing with it (without even
knowing) in this process. We want to start from a clean slate and
leave the slate clean.

Change-Id: I42b9a7973ec5c4f42578779dc6ad59274212113f
Closes-Bug: #1696267
This commit is contained in:
Chris Dent 2017-06-06 22:47:49 +00:00
parent e78c923410
commit 11f4b62745
1 changed files with 11 additions and 3 deletions

View File

@ -1536,9 +1536,17 @@ class ResourceClassTestCase(ResourceProviderBaseCase):
class ResourceProviderTraitTestCase(ResourceProviderBaseCase):
def tearDown(self):
"""Reset the _TRAITS_SYNCED boolean so it doesn't interfere."""
super(ResourceProviderTraitTestCase, self).tearDown()
def setUp(self):
super(ResourceProviderTraitTestCase, self).setUp()
# Reset the _TRAITS_SYNCED global before we start and after
# we are done since other tests (notably the gabbi tests)
# may have caused it to change.
self._reset_traits_synced()
self.addCleanup(self._reset_traits_synced)
@staticmethod
def _reset_traits_synced():
"""Reset the _TRAITS_SYNCED boolean to base state."""
rp_obj._TRAITS_SYNCED = False
def _assert_traits(self, expected_traits, traits_objs):