vutran1710 / PyrateLimiter

⚔️Python Rate-Limiter using Leaky-Bucket Algorithm Family
https://pyratelimiter.readthedocs.io
MIT License
334 stars 36 forks source link

Test suite problems #127

Closed farchord closed 8 months ago

farchord commented 1 year ago

Hello!

So I'm the maintainer for this library on Fedora. I'm working on updating the package to version 3.1.0 from 2.10.

When we run the tests, we get a very high amount of those:

--- Logging error --- Traceback (most recent call last): File "/usr/lib64/python3.12/logging/init.py", line 1163, in emit stream.write(msg + self.terminator) ValueError: I/O operation on closed file. Call stack: File "/usr/lib64/python3.12/threading.py", line 1009, in _bootstrap self._bootstrap_inner() File "/usr/lib64/python3.12/threading.py", line 1052, in _bootstrap_inner self.run() File "/usr/lib64/python3.12/threading.py", line 989, in run self._target(*self._args, **self._kwargs) File "/builddir/build/BUILD/pyrate_limiter-3.1.0/pyrate_limiter/abstracts/bucket.py", line 156, in _leak_task_sync logger.info("(sync)leaking bucket: %s, %s items", bucket, leak) Message: '(sync)leaking bucket: %s, %s items' Arguments: (<pyrate_limiter.buckets.in_memory_bucket.InMemoryBucket object at 0x7f9f1896a360>, 0)

That error shows roughly 50-60 times during the test suite.

Would you happen to know what that means?

BunnyApocalypse commented 1 year ago

Hi I'm the other co-maintainer.

I've looked into this and commenting out the logging on line 156 of abstracts/bucket.py resolves this issue.

Looks like the issue might lie with an interaction between the builtin logging library and our build environment, but maybe you'd have more insight.

vutran1710 commented 1 year ago

so, is there any action needed from my side?

farchord commented 1 year ago

Only one:

It seems testing has a hard dependency on version 6 specifically (Not "greater than or equal to"), is that a mistake?

vutran1710 commented 1 year ago

Only one:

It seems testing has a hard dependency on version 6 specifically (Not "greater than or equal to"), is that a mistake?

Oh you mean the coverage? If so then yeah thats my mistake - it should have been ">=".

Actually during the development of v3, i stumbled on some thread-related bug of pytest-cov/coverage/nox (couldn't figure out which one caused the bug) that kept breaking the test suite so I had to bump them.

I can help out, but we have to be sure that both our build env work just fine

farchord commented 1 year ago

I can't test pyrate_limiter in Fedora. About 60% of the packages required to test the package are either not packaged in Fedora, or too old. So for now, I'm doing a simple import test on build.

So the coverage issue is honestly not critical for us at the moment because we don't actually run tests right now. But later on, as packages become available, we might! So I wanted to report the problem :)