test_atexit_hook wasn't testing what it meant to.
This commit is contained in:
parent
9143e187d3
commit
7fb570d334
@ -22,7 +22,7 @@ sys.path[0:0] = [""]
|
||||
|
||||
from pymongo.monitor import MONITORS
|
||||
from test import unittest, port, host, IntegrationTest
|
||||
from test.utils import single_client, wait_until
|
||||
from test.utils import single_client, wait_until, one
|
||||
|
||||
|
||||
class TestMonitor(IntegrationTest):
|
||||
@ -33,12 +33,16 @@ class TestMonitor(IntegrationTest):
|
||||
wait_until(lambda: MONITORS - prior_monitors,
|
||||
'register new monitor')
|
||||
|
||||
# Just one new monitor should have been registered.
|
||||
new_monitor_refs = MONITORS - prior_monitors
|
||||
self.assertEqual(1, len(new_monitor_refs))
|
||||
monitor_ref = one(new_monitor_refs)
|
||||
del client
|
||||
|
||||
start = time.time()
|
||||
while time.time() - start < 30:
|
||||
gc.collect()
|
||||
if MONITORS - prior_monitors:
|
||||
if monitor_ref not in MONITORS:
|
||||
# New monitor was unregistered.
|
||||
break
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user