Commit 0f85ebd9 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix asyncnotifier unit tests



On my workstation, if I run the following two tests in this exact
order:

- TestSingleFileEventHandler.testError
- TestSingleFileEventHandler.testReplace

the second test will fail, because there is no "unregister" of
previous tests (and the poll() done by asyncore will fire on the
previous files which are now removed, etc. etc.).

While investigating this, I realised that we don't do any cleanup of
the various handlers/notifiers we setup for this test, so if we simply
add a proper cleanup, the tests will work nicely (in any order :).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 3bd0f3d8
#!/usr/bin/python
#
# Copyright (C) 2010 Google Inc.
# Copyright (C) 2010, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -73,6 +73,15 @@ class TestSingleFileEventHandler(testutils.GanetiTestCase):
# TERM notifier is enabled by default, as we use it to get out of the loop
self.ihandler[self.NOTIFIER_TERM].enable()
def tearDown(self):
# disable the inotifiers, before removing the files
for i in self.ihandler:
i.disable()
testutils.GanetiTestCase.tearDown(self)
# and unregister the fd's being polled
for n in self.notifiers:
n.del_channel()
class OnInotifyCallback:
def __init__(self, testobj, i):
self.testobj = testobj
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment