(self)
| 30 | def decorator(test_method): |
| 31 | @functools.wraps(test_method) |
| 32 | def new_test_method(self): |
| 33 | test_generator = test_method(self) |
| 34 | root = self.root |
| 35 | # Exceptions raised by self.assert...() need to be raised |
| 36 | # outside of the after() callback in order for the test |
| 37 | # harness to capture them. |
| 38 | exception = None |
| 39 | def after_callback(): |
| 40 | nonlocal exception |
| 41 | try: |
| 42 | next(test_generator) |
| 43 | except StopIteration: |
| 44 | root.quit() |
| 45 | except Exception as exc: |
| 46 | exception = exc |
| 47 | root.quit() |
| 48 | else: |
| 49 | # Schedule the Tk mainloop to call this function again, |
| 50 | # using a robust method of ensuring that it gets a |
| 51 | # chance to process queued events before doing so. |
| 52 | # See: https://stackoverflow.com/q/18499082#comment65004099_38817470 |
| 53 | root.after(delay, root.after_idle, after_callback) |
| 54 | root.after(0, root.after_idle, after_callback) |
| 55 | root.mainloop() |
| 56 | |
| 57 | if exception: |
| 58 | raise exception |
| 59 | |
| 60 | return new_test_method |
| 61 |
nothing calls this directly
no test coverage detected
searching dependent graphs…