Skip to content

Conversation

@okurz
Copy link
Member

@okurz okurz commented Oct 20, 2025

No description provided.

@okurz okurz force-pushed the feature/increase_test_coverage3 branch from 25887fb to 7440e77 Compare October 20, 2025 19:11
@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.09%. Comparing base (09e7b7f) to head (05a74b4).
⚠️ Report is 133 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
+ Coverage   73.92%   75.09%   +1.17%     
==========================================
  Files          30       30              
  Lines        2646     2646              
==========================================
+ Hits         1956     1987      +31     
+ Misses        690      659      -31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@okurz okurz changed the title t: Add tests for AggregateResultsSync t: Add tests for AggregateResultsSync+codecov Oct 20, 2025
@okurz okurz changed the title t: Add tests for AggregateResultsSync+codecov PART 2: t: Add tests for AggregateResultsSync+codecov - After #244 Oct 20, 2025
@okurz okurz force-pushed the feature/increase_test_coverage3 branch from 5b81d16 to 742a933 Compare October 20, 2025 19:23
sync.client.get_jobs.return_value = [{"id": 1}]
assert sync() == 0
mock_normalize.assert_not_called()
mock_post.assert_not_called()
Copy link
Contributor

Choose a reason for hiding this comment

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

This test should check what jobs have been posted. Otherwise the added coverage is misleading us into thinking this part of the code has tests that would fail if we break something.

Copy link
Member Author

Choose a reason for hiding this comment

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

Could you provide more specific suggestions because I don't understand the code enough yet to be able to solve that easily

Copy link
Contributor

@Martchus Martchus Oct 22, 2025

Choose a reason for hiding this comment

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

You can check the tests for Gitea. There I didn't completely mock away the client but used responses and its API to check what calls were made. (But maybe you can also change @patch("openqabot.aggrsync.SyncRes.post_result") so that invocations are recorded somehow. I didn't use @patch so far so I don't know what's possible with that.)

Comment on lines +48 to +53
args = Namespace(
configs=Path("bar"),
dry=True,
token="null",
instance="null",
openqa_instance=urlparse("http://localhost"),
)
sync = AggregateResultsSync(args)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe these repeated lines could go into a helper function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I am wondering about what is the best approach for reusing. Should we use a custom helper function or a test fixture following https://docs.pytest.org/en/7.1.x/how-to/fixtures.html#fixtures-can-request-other-fixtures

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't care. A custom helper function would probably be the easiest/simplest solution (and therefore also the most readable).

@okurz okurz force-pushed the feature/increase_test_coverage3 branch from 742a933 to 4d233cd Compare October 21, 2025 10:14
@okurz okurz changed the title PART 2: t: Add tests for AggregateResultsSync+codecov - After #244 t: Add tests for AggregateResultsSync Oct 21, 2025
@openSUSE openSUSE deleted a comment from mergify bot Oct 21, 2025
@okurz okurz force-pushed the feature/increase_test_coverage3 branch from 4d233cd to c760cc9 Compare October 22, 2025 07:23
Add initial tests for the AggregateResultsSync class, covering the
constructor and a basic call with no settings.
@okurz okurz force-pushed the feature/increase_test_coverage3 branch from c760cc9 to 05a74b4 Compare October 22, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants