Skip to content

Conversation

@AbduazizZiyodov
Copy link
Member

Closes #3243

Hi, I've only changed some existing tests & added one assert statement which checks total_tokens in case of zero. What kind of other tests should be included, if any needed ?

@codecov
Copy link

codecov bot commented Aug 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00000%. Comparing base (c1e1167) to head (4ef6ba8).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@               Coverage Diff               @@
##                 main        #3321   +/-   ##
===============================================
  Coverage   100.00000%   100.00000%           
===============================================
  Files             125          125           
  Lines           19497        19547   +50     
  Branches         1334         1336    +2     
===============================================
+ Hits            19497        19547   +50     
Files with missing lines Coverage Δ
src/trio/_sync.py 100.00000% <100.00000%> (ø)
src/trio/_tests/test_sync.py 100.00000% <100.00000%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Could you:

  • add a newsfragment
  • add a test for something like:
    • create and use a capacity limiter with a limit of, say, 5
    • set the limit to 0
    • make sure it stops letting anything through
    • set the limit up to, say, 5
    • make sure it let everything through
  • maybe also a test that a 0 limit capacity limiter doesn't let any tasks through? This is covered by the above but it's better to be extra sure.

If you can think of any case you're unsure works, that's what you would make a test case for!

@AbduazizZiyodov
Copy link
Member Author

@A5rocks of course, I'll let you know then 🤝

@A5rocks
Copy link
Contributor

A5rocks commented Sep 6, 2025

@AbduazizZiyodov did you run into any issues? I can maybe be a bit more detailed about something if so!

@AbduazizZiyodov
Copy link
Member Author

AbduazizZiyodov commented Sep 8, 2025

@A5rocks I've added extra tests as you said (so far no "problema"), I'll be looking forward for your review.

Copy link
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

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

Minor nitpicks but this makes sense to me.

@AbduazizZiyodov
Copy link
Member Author

@A5rocks ready, I guess

@A5rocks A5rocks requested a review from Zac-HD September 10, 2025 03:15
Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Thanks @AbduazizZiyodov! We really appreciate the time and care you put into this, and I'm looking forward to cleaning up a bit of affected code downstream.

@Zac-HD Zac-HD merged commit f103929 into python-trio:main Sep 10, 2025
43 checks passed
@trio-bot
Copy link

trio-bot bot commented Sep 10, 2025

Hey @AbduazizZiyodov, it looks like that was the first time we merged one of your PRs! Thanks so much! 🎉 🎂

If you want to keep contributing, we'd love to have you. So, I just sent you an invitation to join the python-trio organization on Github! If you accept, then here's what will happen:

  • Github will automatically subscribe you to notifications on all our repositories. (But you can unsubscribe again if you don't want the spam.)

  • You'll be able to help us manage issues (add labels, close them, etc.)

  • You'll be able to review and merge other people's pull requests

  • You'll get a [member] badge next to your name when participating in the Trio repos, and you'll have the option of adding your name to our member's page and putting our icon on your Github profile (details)

If you want to read more, here's the relevant section in our contributing guide.

Alternatively, you're free to decline or ignore the invitation. You'll still be able to contribute as much or as little as you like, and I won't hassle you about joining again. But if you ever change your mind, just let us know and we'll send another invitation. We'd love to have you, but more importantly we want you to do whatever's best for you.

If you have any questions, well... I am just a humble Python script, so I probably can't help. But please do post a comment here, or in our chat, or on our forum, whatever's easiest, and someone will help you out!

@AbduazizZiyodov AbduazizZiyodov deleted the capacity-limiter-zero-tokens branch September 10, 2025 10:47
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.

Allow CapacityLimiter to have total_tokens=0

3 participants