|
10 | 10 | # SPDX-License-Identifier: LGPL-3.0 |
11 | 11 | ############################################################### |
12 | 12 |
|
13 | | -import unittest |
14 | | -import os |
15 | 13 | import gc |
| 14 | +import os |
16 | 15 | import signal |
| 16 | +import unittest |
| 17 | + |
17 | 18 | import flux |
18 | 19 | from subflux import rerun_under_flux |
19 | 20 |
|
@@ -67,8 +68,8 @@ def test_timer_callback_exception(self): |
67 | 68 | def cb(x, y, z, w): |
68 | 69 | raise RuntimeError("this is a test") |
69 | 70 |
|
70 | | - with self.f.timer_watcher_create(0.01, cb) as timer: |
71 | | - with self.assertRaises(RuntimeError) as cm: |
| 71 | + with self.f.timer_watcher_create(0.01, cb): |
| 72 | + with self.assertRaises(RuntimeError): |
72 | 73 | self.f.reactor_run() |
73 | 74 |
|
74 | 75 | def test_msg_watcher_unicode(self): |
@@ -155,7 +156,7 @@ def raise_signal(handle, watcher, revents, args): |
155 | 156 | # Create new Flux handle to avoid potential stale state in |
156 | 157 | # self.f handle. (makes test unreliable) |
157 | 158 | h = flux.Flux() |
158 | | - with h.signal_watcher_create(signal.SIGUSR2, signal_cb) as watcher: |
| 159 | + with h.signal_watcher_create(signal.SIGUSR2, signal_cb): |
159 | 160 | h.timer_watcher_create(0.05, raise_signal).start() |
160 | 161 | with self.assertRaises(RuntimeError): |
161 | 162 | rc = h.reactor_run() |
@@ -231,7 +232,7 @@ def cb_abort(handle, watcher, revents, _args): |
231 | 232 | self.f.timer_watcher_create(0.0, cb, repeat=0.05).start() |
232 | 233 |
|
233 | 234 | # Timeout/abort after 5s |
234 | | - tw = self.f.timer_watcher_create(5.0, cb_abort).start() |
| 235 | + self.f.timer_watcher_create(5.0, cb_abort).start() |
235 | 236 | self.f.reactor_run() |
236 | 237 |
|
237 | 238 | # callback should have been called 5 times, not less |
|
0 commit comments