Commit 7eeec25
committed
fix(test): resolve flaky test_midnight_heartbeats boundary condition
The test was intermittently failing with `assert 9 == 8` because:
1. `midnight` retained residual microseconds from `datetime.now()`, making
the exact midnight boundary non-deterministic across runs
2. Event 9 (starting at 23:59 with 1-min duration) has endtime exactly at
midnight, and the server's `endtime >= start_query` condition sometimes
includes it in the "after midnight" query results
Fix: zero out seconds/microseconds on the start timestamp for deterministic
boundaries, and add a 1ms offset to the query start to avoid the ambiguous
boundary where events ending exactly at midnight could be included.
Closes ActivityWatch/activitywatch#1211 (follow-up)1 parent 4089343 commit 7eeec25
1 file changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
257 | 261 | | |
258 | 262 | | |
259 | 263 | | |
| |||
264 | 268 | | |
265 | 269 | | |
266 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
267 | 275 | | |
268 | | - | |
| 276 | + | |
269 | 277 | | |
270 | 278 | | |
271 | 279 | | |
| |||
0 commit comments