Revision e543a42f test/ganeti.asyncnotifier_unittest.py
b/test/ganeti.asyncnotifier_unittest.py | ||
---|---|---|
24 | 24 |
import unittest |
25 | 25 |
import signal |
26 | 26 |
import os |
27 |
import tempfile |
|
28 |
import shutil |
|
27 | 29 |
|
28 | 30 |
try: |
29 | 31 |
# pylint: disable-msg=E0611 |
... | ... | |
149 | 151 |
self.assertEquals(self.notifiers[self.NOTIFIER_TERM].error_count, 0) |
150 | 152 |
|
151 | 153 |
|
154 |
class TestSingleFileEventHandlerError(unittest.TestCase): |
|
155 |
def setUp(self): |
|
156 |
self.tmpdir = tempfile.mkdtemp() |
|
157 |
|
|
158 |
def tearDown(self): |
|
159 |
shutil.rmtree(self.tmpdir) |
|
160 |
|
|
161 |
def test(self): |
|
162 |
wm = pyinotify.WatchManager() |
|
163 |
handler = asyncnotifier.SingleFileEventHandler(wm, None, |
|
164 |
utils.PathJoin(self.tmpdir, |
|
165 |
"nonexist")) |
|
166 |
self.assertRaises(errors.InotifyError, handler.enable) |
|
167 |
self.assertRaises(errors.InotifyError, handler.enable) |
|
168 |
handler.disable() |
|
169 |
self.assertRaises(errors.InotifyError, handler.enable) |
|
170 |
|
|
171 |
|
|
152 | 172 |
if __name__ == "__main__": |
153 | 173 |
testutils.GanetiTestProgram() |
Also available in: Unified diff