Skip to content

Commit

Permalink
test: reduce leftovers noise
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Sep 21, 2023
1 parent 3cd4ae2 commit 0d2325a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/p4p/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand All @@ -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()
Expand Down

0 comments on commit 0d2325a

Please sign in to comment.