Disable gc in test_scheduler.TestExecutor

Fix random failures seens in test_scheduler.TestExecutor.

Saw random failures sometime on py35 sometime on py36 test
on the pagure driver patch: https://review.opendev.org/604404/

With that patch I no longer see the random failures.

This disable is already done in tests/base.py assertFinalState.

Change-Id: I156f85cacd8c14e0205f629dc273d1d9c390ab81
This commit is contained in:
Fabien Boucher 2019-05-24 16:48:55 +02:00
parent 48c049db79
commit aeb5ef4ef6
1 changed files with 11 additions and 5 deletions

View File

@ -5740,11 +5740,17 @@ class TestExecutor(ZuulTestCase):
# Make sure that git.Repo objects have been garbage collected.
repos = []
gc.collect()
for obj in gc.get_objects():
if isinstance(obj, git.Repo):
self.log.debug("Leaked git repo object: %s" % repr(obj))
repos.append(obj)
gc.disable()
try:
gc.collect()
for obj in gc.get_objects():
if isinstance(obj, git.Repo):
self.log.debug("Leaked git repo object: %s" % repr(obj))
repos.append(obj)
gc.enable()
except Exception:
gc.enable()
raise
self.assertEqual(len(repos), 0)
def test_executor_shutdown(self):