Closed ento closed 6 months ago
Kudos, no new issues were introduced!
0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
Hi @ento, I see the same pattern here, with the addition of wanting to solve many problems at the same time. Could you please open an issue for each problem you are trying to solve, with a snippet of code that shows what is failing? Many thanks!
Sure, opened a few issues:
If it's this repo's general process to require an issue when opening a PR, it'll be useful to have a 'CONTRIBUTING' file or a section in the README that instructs contributors about the process - will save one round of back-and-forth for new contributors and the maintainer alike :)
will save one round of back-and-forth for new contributors and the maintainer alike :)
I agree, but please note Mocket is still, and probably it'll ever be, a very small project. When people contribute, it's mostly for opening issues. I don't mind if people reach out to me directly with a PR, the problem here was the amount of issues in a single one. I really wanted to keep track of what we are doing here.
Hi @ento, I merged all your commits, with a very small change to get rid of an unnecessary else
.
The only piece of code I am not 100% sure about is the test using psutil
. I've just seen it failing a couple times, still not sure why.
Re: issue vs PR - that's fair. Thanks for the new release!
Re: the psutil
test - I wanted to test it in a single, short test case that checks something close to the root cause ("no dangling open file descriptor"), but switching it out for a test that checks the symptom ("no error raised after making many requests with a low ulimit value", e.g. the example in #217) might be better, although it'll take a little longer to run.
Hi @ento, I am sorry if I haven't made any progress with your feature proposal related to the strict mode. I was counting on working on it as soon as I finished preparing the release with all your bugfixes, but it's being a nightmare at work.
@mindflayer No worries, I'm not exactly blocked by the feature proposal getting taken up (I can always use a temporary fork). Your well-being comes first!
This PR attempts to fix a few issues:
In a project I'm working with, a mocketized test would fail if it ran after a test that makes a real HTTPS request. Both use aiohttp. Clearing aiohttp's internal cache that holds an SSLContext object fixed the issue.
I encountered more issues while trying to write a PR for the above:
Mocket.r_fd
fromMocketSocket.fileno
if it's already set and closing the pipe's file descriptors when resetting MocketSSLWantReadError
gets raised and get retried later. With Mocket, it returns an empty string in that case, which causes the connection to get shut down. Tracing function calls using hunter was helpful in determining the cause here.SSLWantReadError
when SSL handshake occurred and no bytes have been sent back yet. This works with my project's test suite, but admittedly I'm not sure if there's a case where this would cause an infinite loop waiting for a response or some other failure. But I guess that'd correspond to timeouts, which are something that can happen in real-life scenarios too.MocketSocket.recv_into
may receive a memorybuffer objectwrite
attributessl=False
failed because it calls a method on SSLContext object that wasn't mocked by MocketFakeSSLContext.DUMMY_METHODS