Skip to content

Adding or updating tests to improve codecov coverage.#7292

Open
samuel-denton wants to merge 10 commits into
cylc:masterfrom
samuel-denton:8.6.x_7277_codecov
Open

Adding or updating tests to improve codecov coverage.#7292
samuel-denton wants to merge 10 commits into
cylc:masterfrom
samuel-denton:8.6.x_7277_codecov

Conversation

@samuel-denton

@samuel-denton samuel-denton commented May 1, 2026

Copy link
Copy Markdown
Contributor

Closes #7277
Adding some new tests or updating tests to improve code coverage.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@samuel-denton samuel-denton self-assigned this May 1, 2026
@samuel-denton samuel-denton added this to the 8.6.x milestone May 6, 2026
@samuel-denton samuel-denton linked an issue May 6, 2026 that may be closed by this pull request
5 tasks
@samuel-denton

This comment was marked as resolved.

@samuel-denton samuel-denton marked this pull request as ready for review May 8, 2026 15:33
@samuel-denton samuel-denton removed a link to an issue May 8, 2026
5 tasks
…ecov)

Added test for CommandFailedError in exceptions.py

Update test_exceptions.py

Linter wants 2 blank lines at the end of the file.

Update test_exceptions.py

Linter now wants the blank lines removed...

Test added for FileRemovalError(CylcError):

added test for CylcVersionError

Test added for TaskOutputs.is_message_complete()

Update test_exceptions.py

Shortened a line to make the linter happy

Added 2 new tests to cover TaskOutputs.format_completion_status()
Included a test for color wrap even though codecov says its covered as I think the if statements are reached but each branch is not explored so I've added that.

Added test for TaskOutputs._is_compvar_complete()

added test for CylcTimeParser.parse_timepoint() for when point is None
and for CylcTimeParser.parse_recurrence() when expression is unparsable.

Added test to cover all 10 branches of CylcTimeParser._get_interval_from_expression()

Added test for CylcTimeParse.parse_recurrence() for the case there start and end points are provided.
Added test for CylcTimeParser._get_min_from_expression() for the case where a valid offset if provided for the point, and context is None.

Added test for CylcTimeParser._get_point_from_expression() for the case where a point is provided, but it resolves to a non real point (hour 25)

Added test for CylcTimeParser.parse_timepoint() for the case where the point given is None.

Added 3 tests for branches of TaskProxy.get_point_as_seconds()

Added test for TaskProxy.is_ready_to_run() for 7 different cases.
@samuel-denton samuel-denton changed the base branch from 8.6.x to master May 11, 2026 10:31
@oliver-sanders oliver-sanders modified the milestones: 8.6.x, 8.7.0 May 11, 2026
Comment thread tests/unit/test_task_id.py
Comment thread tests/unit/test_time_parser.py Outdated
@oliver-sanders

oliver-sanders commented May 19, 2026

Copy link
Copy Markdown
Member

From the latest coverage run:

module before after
cylc.flow.exceptions 94.55 99.39
cylc.flow.task_outputs 96.32 💯
cylc.flow.time_parser 91.83 💯
cylc.flow.task_proxy 96.26 💯
cylc.flow.task_id 96.15 💯

Nice.

There is some random jitter which has caused coverage in cylc.flow.graph_parser and cylc.flow.scripts.cylc to reduce. That isn't related to this PR, likely the result of functional tests re-running and intermittently covering error cases they weren't intended to.

Comment thread tests/unit/test_task_proxy.py Outdated
Comment thread tests/unit/test_task_proxy.py Outdated
Comment thread tests/unit/test_time_parser.py Outdated


def test_get_interval_from_expression(parsers):
"""It should infer interval from truncated context point."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the function being tested is the cause of a bug: #2382 (comment)

We can keep the tests but it would be worth referencing the issue in the docstring

Comment thread tests/unit/test_time_parser.py Outdated
samuel-denton and others added 3 commits June 11, 2026 11:04
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
Comment thread cylc/flow/time_parser.py Outdated
@samuel-denton samuel-denton requested a review from MetRonnie June 11, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coverage: low-hanging fruit

4 participants