This repository was archived by the owner on Jan 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 196
The _remaining_capacity > _bytes_in_buffer check in bufsocket.py is unnecessary #300
Comments
I suspect you're right. ;) Anyone who wants to apply this patch is welcome to. |
I wonder how long do all the tests take to run, normally? |
For running the tests I recommend using tox, but you may have encountered a test hang. This project has CI, so you can simply open a PR if you'd prefer. |
Could you give me an estimate? So that I know if tests indeed hang. |
On my machine under tox it runs in 6 seconds. I think we encountered problems with coverage measurements and pytest-xdist so the tests as run by tox moved away from that style, but I guess we didn't update the Makefile. |
OK I'll try tox to see if everything works. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is not an actual issue, but a possible tiny improvement.
TL;DR
I think this check
self._remaining_capacity > self._bytes_in_buffer
in bufsocket.py#L141 is unnecessary.Here's why.
From the definitions we know:
We also know that each time
self._bytes_in_buffer
increases, the increment is less than_buffer_size - _buffer_end
. An example:Now we have two formulas:
Thus
_bytes_in_buffer < _remaing_capacity
is alwaysTrue
.I intended to remove the check and run tests, but unfortunately I was not able to finish them(I have all the test deps installed and run
make test
, don't know why it takes so long). So I'm not 100% sure it can be removed.The text was updated successfully, but these errors were encountered: