Commit 2a0f803
authored
Improved unit test coverage of mig lib daemon (#367)
* Use a shared `before_each` init to isolate test configuration etc.
Add coverage of several previously missing branches and corner cases.
- Direct event helper testing
- Signal handler verification
- Concurrent event handling
- Nap timing accuracy checks
- Multiple reset cycles
- Error cases like invalid arguments
- Various sleep interruption scenarios
* Implement a new helper to unregister all registered signals and use it in unit
tests to increase isolation and be able to test handling when no handlers where
registered.
* Added unit test coverage:
- Immediate sleep exit with max_secs < nap_secs
- Positional argument handling
- Negative max_secs handling
- Zero max_secs handling
- Unregistered signal safety
- Consecutive signal handling
- Verify explicit unregistration of signal handlers
- Test sleep terminating after a condition becomes true
- Edge case test for equal max/sleep durations
- Test error handling when break conditions raise exceptions
- Direct tests of state reset and setting helpers
- Integration test with real signal delivery
* Switch dummy conf and logger to the default ones from `_provide_configuration`.
Move used_signal accounting to class-level. Perhaps we want to maintain it on
actual use and add helpers to track active ones eventually.
* Address the review comment on PR367 about the edge cases not really being
verified by inserting missing `assert`s.
* Adjust conflicting handler test to behave as expected with only the last handler
assigned being active.
* Increase test coverage to 100% with more corner case tests of sleep intervals,
unregister, etc.
* Remove useless and unused result from `interruptible_sleep`, also called out by
pylint.1 parent 083770f commit 2a0f803
2 files changed
+512
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
71 | 83 | | |
72 | 84 | | |
73 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
0 commit comments