Skip to content

Commit 5cf11ca

Browse files
committed
test(cover): Intermittent daemon loop cover hole
When running the tests for the different Python versions in parallel, sometimes the inner daemon loop would take long enough that it exceeded even the `0.1` polling time, leaving an intermittent coverage hole. I was able to reproduce this on my laptop and I think on my home server used as a GitLab CI/CD runner. I'm concerned that this poll value may still not be conservative enough, for example for someone doing local development on a Chromebook or a tablet. Though such developers are much more likely to use CI instead of running locally. So we'll see if this intermittent coverage hole re-emerges and deal with it then.
1 parent ab9c93f commit 5cf11ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/prunerr/runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,10 @@ def daemon(
344344
# no event we can subscribe to that reliably determines disk space margin
345345
# *as* the download clients are downloading:
346346
if (time_left := poll - (time.time() - start)) > 0:
347-
time.sleep(time_left)
347+
# Intermittent coverage hole here when the machine running the tests is
348+
# slow or overloaded enough that the inner daemon loop takes more time
349+
# to run than the poll value used in the tests:
350+
time.sleep(time_left) # pragma: no cover
348351
logger.debug("Sub-command `daemon` looping after %ss", time.time() - start)
349352

350353
# Methods to list the download items in each life-cycle stage:

0 commit comments

Comments
 (0)