Skip to content

Conversation

@Czaki
Copy link
Collaborator

@Czaki Czaki commented Feb 3, 2026

To improve readability of the stack trace, accept the time argument.

Summary by Sourcery

Tests:

  • Update the not_start QTimer.start test mock to accept an optional time parameter without changing its failure behavior.

Summary by CodeRabbit

  • Tests
    • Fixed test configuration to properly handle optional parameters, improving test execution reliability and preventing argument mismatch errors during test runs.

To improve readability of stactrace accept the time argument.
@Czaki Czaki added this to the 0.16.5 milestone Feb 3, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 3, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates a QTimer.start mock helper in tests so the not_start mock function mirrors the real start signature by accepting an optional time argument, improving stack trace readability and compatibility with call sites.

File-Level Changes

Change Details Files
Align the not_start QTimer.start mock signature with the real method by adding an optional time parameter.
  • Modify the not_start mock helper to accept an optional time=None parameter, matching the real QTimer.start signature
  • Keep the behavior of not_start the same by still raising a RuntimeError when invoked
  • Continue monkeypatching QTimer.start with not_start so tests fail fast if the timer is unexpectedly used
package/tests/test_PartSeg/conftest.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

The test configuration file is updated to modify a patching stub method. The not_start method now accepts an optional time parameter to align with how QTimer.start may be invoked with a timeout argument, preventing signature mismatch errors.

Changes

Cohort / File(s) Summary
Test Configuration
package/tests/test_PartSeg/conftest.py
Added optional time parameter to not_start stub method to accommodate QTimer.start calls with timeout argument.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A timer's stub now flexes wide,
With optional time to coincide,
No more mismatches, no more fuss,
The test mocks bloom for all of us! ✨⏲️

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: modifying a mock's function signature to accept an optional time argument.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch accept_time_in_block

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • To make the mock more robust against future changes in QTimer.start, consider matching its full signature (e.g., using *args, **kwargs or the exact parameter name and type) rather than only adding an optional time=None argument.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- To make the mock more robust against future changes in `QTimer.start`, consider matching its full signature (e.g., using `*args, **kwargs` or the exact parameter name and type) rather than only adding an optional `time=None` argument.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.15%. Comparing base (4510409) to head (82c8e49).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1350      +/-   ##
===========================================
- Coverage    93.17%   93.15%   -0.02%     
===========================================
  Files          210      210              
  Lines        33251    33251              
===========================================
- Hits         30981    30976       -5     
- Misses        2270     2275       +5     

☔ 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@package/tests/test_PartSeg/conftest.py`:
- Around line 93-94: The stub method not_start currently raises a RuntimeError
but its signature (self, time=None) triggers Ruff ARG001 for unused args; update
the not_start definition to either accept arbitrary args (def not_start(self,
*args, **kwargs):) or annotate the existing parameters with a noqa (e.g. def
not_start(self, time=None):  # noqa: ARG001) and keep the RuntimeError,
referencing the not_start method to locate the change.

Comment on lines +93 to 94
def not_start(self, time=None):
raise RuntimeError("Thread should not be used in test")
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Silence Ruff ARG001 for the unused stub parameters.

Ruff flags unused self and time here. Either ignore via # noqa: ARG001 or accept arbitrary args to keep lint clean.

💡 Minimal fix
-    def not_start(self, time=None):
+    def not_start(*_, **__):
         raise RuntimeError("Thread should not be used in test")
🧰 Tools
🪛 Ruff (0.14.14)

[warning] 93-93: Unused function argument: self

(ARG001)


[warning] 93-93: Unused function argument: time

(ARG001)


[warning] 94-94: Avoid specifying long messages outside the exception class

(TRY003)

🤖 Prompt for AI Agents
In `@package/tests/test_PartSeg/conftest.py` around lines 93 - 94, The stub method
not_start currently raises a RuntimeError but its signature (self, time=None)
triggers Ruff ARG001 for unused args; update the not_start definition to either
accept arbitrary args (def not_start(self, *args, **kwargs):) or annotate the
existing parameters with a noqa (e.g. def not_start(self, time=None):  # noqa:
ARG001) and keep the RuntimeError, referencing the not_start method to locate
the change.

@Czaki Czaki changed the title chore: accept time arguemt in not_start mock of timer start chore: accept time argumet in not_start mock of timer start Feb 3, 2026
@Czaki Czaki changed the title chore: accept time argumet in not_start mock of timer start chore: accept time argument in not_start mock of timer start Feb 3, 2026
@Czaki Czaki merged commit 09f502f into develop Feb 4, 2026
60 of 64 checks passed
@Czaki Czaki deleted the accept_time_in_block branch February 4, 2026 08:04
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