Mercurial > public > mercurial-scm > hg-stable
diff tests/test-sshserver.py @ 51483:13c004b54cbe stable
wireprotoserver: ensure that output stream gets flushed on exception
Previously flush was happening due to Python finalizer being run on
`BufferedWriter`. With upgrade to Python 3.11 this started randomly
failing.
My guess is that the finalizer on the raw `FileIO` object may
be running before the finalizer of `BufferedWriter` has a chance to run.
At any rate, since we're not relying on finalizers in the happy case
we should also not rely on them in case of exception.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Thu, 04 Apr 2024 14:15:32 +0100 |
parents | 642e31cb55f0 |
children |
line wrap: on
line diff
--- a/tests/test-sshserver.py Mon Apr 15 16:33:37 2024 +0100 +++ b/tests/test-sshserver.py Thu Apr 04 14:15:32 2024 +0100 @@ -25,9 +25,8 @@ def assertparse(self, cmd, input, expected): server = mockserver(input) - proto = wireprotoserver.sshv1protocolhandler( - server._ui, server._fin, server._fout - ) + ui = server._ui + proto = wireprotoserver.sshv1protocolhandler(ui, ui.fin, ui.fout) _func, spec = wireprotov1server.commands[cmd] self.assertEqual(proto.getargs(spec), expected) @@ -35,6 +34,9 @@ def mockserver(inbytes): ui = mockui(inbytes) repo = mockrepo(ui) + # note: this test unfortunately doesn't really test anything about + # `sshserver` class anymore: the entirety of logic of that class lives + # in `serveuntil`, and that function is not even called by this test. return wireprotoserver.sshserver(ui, repo)