NCAS-CMS / NCAS-CMS/cf-python

Address flakiness of `test_curl_xy`

Open
#348 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

testing
Dominant language
Python
Stars
150
Forks
23
Avg merge
1d 11h
Merged PRs (30d)
2

Description

test_curl_xy from the test_Maths module is proving itself to be a flaky test, particularly when run within the CI jobs rather than locally (at least as far as I have observed locally, where it always passes):

FAIL: test_curl_xy (test_Maths.MathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/tmp/test_cf-python/cf/test/test_Maths.py", line 146, in test_curl_xy
    self.assertTrue((c.data == c0.data).all())
AssertionError: False is not true

We should adapt it so that the outcome is reliably deterministic. It is probably a simple-enough case of testing floating point equality to a tolerance rather than strict equality as present.

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 test/test_Maths.py, especially test_curl_xy around the failing assertion at line 146. Run the test in the CI-like environment and compare the floating-point data used by c.data and c0.data. It is done when the test uses a tolerance appropriate to the observed floating-point variation and passes reliably.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.