Allow ClientSession objects to get cleaned up by the garbage collector

Fixes #1652
This commit is contained in:
mprahl 2019-09-19 15:24:21 -04:00
parent 1e35e60c21
commit a552a248db
2 changed files with 20 additions and 2 deletions

View file

@ -1,6 +1,7 @@
from __future__ import absolute_import
import mock
import six
import weakref
try:
import unittest2 as unittest
except ImportError:
@ -227,3 +228,11 @@ class TestMultiCall(unittest.TestCase):
self.assertEqual(2, self.ksession._sendCall.call_count)
self.assertEqual([['a', 'b', 'c'],
{'faultCode': 1000, 'faultString': 'msg'}], ret)
def test_MultiCallHack_weakref_validation(self):
expected_exc = 'The session parameter must be a weak reference'
with self.assertRaisesRegexp(TypeError, expected_exc):
koji.MultiCallHack(self.ksession)
# This should not raise an exception
koji.MultiCallHack(weakref.ref(self.ksession))