Mercurial > public > mercurial-scm > hg-stable
diff tests/sshprotoext.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | b4d85bc122bd |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/tests/sshprotoext.py Sat Oct 05 10:29:34 2019 -0400 +++ b/tests/sshprotoext.py Sun Oct 06 09:45:02 2019 -0400 @@ -25,14 +25,17 @@ configitem(b'sshpeer', b'mode', default=None) configitem(b'sshpeer', b'handshake-mode', default=None) + class bannerserver(wireprotoserver.sshserver): """Server that sends a banner to stdout.""" + def serve_forever(self): for i in range(10): self._fout.write(b'banner: line %d\n' % i) super(bannerserver, self).serve_forever() + class prehelloserver(wireprotoserver.sshserver): """Tests behavior when connecting to <0.9.1 servers. @@ -41,6 +44,7 @@ to SSH servers. This mock server tests behavior of the handshake when ``hello`` is not supported. """ + def serve_forever(self): l = self._fin.readline() assert l == b'hello\n' @@ -48,13 +52,15 @@ wireprotoserver._sshv1respondbytes(self._fout, b'') l = self._fin.readline() assert l == b'between\n' - proto = wireprotoserver.sshv1protocolhandler(self._ui, self._fin, - self._fout) + proto = wireprotoserver.sshv1protocolhandler( + self._ui, self._fin, self._fout + ) rsp = wireprotov1server.dispatch(self._repo, proto, b'between') wireprotoserver._sshv1respondbytes(self._fout, rsp.data) super(prehelloserver, self).serve_forever() + def performhandshake(orig, ui, stdin, stdout, stderr): """Wrapped version of sshpeer._performhandshake to send extra commands.""" mode = ui.config(b'sshpeer', b'handshake-mode') @@ -73,8 +79,8 @@ stdin.flush() return orig(ui, stdin, stdout, stderr) else: - raise error.ProgrammingError(b'unknown HANDSHAKECOMMANDMODE: %s' % - mode) + raise error.ProgrammingError(b'unknown HANDSHAKECOMMANDMODE: %s' % mode) + def extsetup(ui): # It's easier for tests to define the server behavior via environment