micropython / micropython/micropython

tests: extmod/time_time_ns.py intermittent failure due to CI runner clock precision

Open
#18,869 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

github-actions tests
Dominant language
C
Stars
22.1k
Forks
9k
Avg merge
6d 4h
Merged PRs (30d)
16

Description

The time_time_ns.py test makes assertions about time.time_ns() precision
that intermittently fail on shared CI runners. Observed in the float (1)
and longlong (1) jobs in a 20-run log window. Attributed to ~7 of 103
failed runs over 14 months.

On shared CI runners the wall clock can have insufficient precision or
the process can be descheduled between measurements, causing timing
assertions to return False instead of True.

This one might be addressable by increasing the tolerance in the test
rather than fixing underlying code.

PR #18861 now ignores this failure in CI.

See analysis: https://gist.github.com/andrewleech/5686ed5242e0948d8679c432579e002e

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with extmod/time_time_ns.py and run the test, focusing on the precision assertions in the float and longlong jobs. Review the linked analysis and inspect how the test measures time; done means the test remains meaningful without intermittent failures on shared CI runners, including the cases currently ignored by PR #18861.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.