Skip to content

refactor(tests): extract factory helpers to resolve code duplication in utils_test#445

Open
olivermeyer wants to merge 1 commit intomainfrom
refactor/remove-duplication
Open

refactor(tests): extract factory helpers to resolve code duplication in utils_test#445
olivermeyer wants to merge 1 commit intomainfrom
refactor/remove-duplication

Conversation

@olivermeyer
Copy link
Collaborator

This should pass SonarCloud's quality gate.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors test code in tests/aignostics/application/utils_test.py to eliminate code duplication by extracting three factory helper functions. The changes target tests for the retrieve_and_print_run_details function, which previously had significant boilerplate in constructing test data.

Changes:

  • Adds three factory helper functions (_make_run_data, _make_item_result, _make_mock_run) to create test fixtures with sensible defaults
  • Refactors 7 tests for retrieve_and_print_run_details to use these factories instead of verbose inline construction
  • Moves imports of ArtifactOutput, ArtifactState, ArtifactTerminationReason, and ItemOutput from function-level to module-level

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

❌ Your project check has failed because the head coverage (63.03%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.
see 2 files with indirect coverage changes

@olivermeyer olivermeyer force-pushed the refactor/remove-duplication branch from c50c19d to b913f33 Compare February 26, 2026 14:17
…in utils_test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 27, 2026 15:01
@olivermeyer olivermeyer force-pushed the refactor/remove-duplication branch from b913f33 to 4069404 Compare February 27, 2026 15:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants