diff --git a/src/p4p/test/utils.py b/src/p4p/test/utils.py index 50f7a6db..8f7b59ca 100644 --- a/src/p4p/test/utils.py +++ b/src/p4p/test/utils.py @@ -28,6 +28,7 @@ unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp class RefTestMixin(object): + __showLeftovers = True """Ensure that each test does not result in a net change in extension object counts """ @@ -48,7 +49,8 @@ def setUp(self): self.__before = self.__refs() for mustzero in ('ClientContextImpl',): - if self.__before.get(mustzero, 0)!=0: + if self.__before.get(mustzero, 0)!=0 and self.__showLeftovers: + self.__showLeftovers = False # only show failure once self.fail('Leftovers from previous test: %s = %d'%(mustzero, self.__before[mustzero])) super(RefTestMixin, self).setUp()