##// END OF EJS Templates
sshserver: redirect stdin/stdout early and use duplicated streams...
sshserver: redirect stdin/stdout early and use duplicated streams This is what we achieved with hook.redirect(True) plus ui.fout = ui.ferr. The hook.redirect() function can't be completely removed yet since hgweb still depends on it. I'm not sure if it is necessary for WSGI servers. CGI needs it, but does WSGI communicate over stdin/stdout channels?

File last commit:

r33929:6c119dbf default
r37964:bfe8ef6e default
Show More
test-encoding-func.py
45 lines | 1.1 KiB | text/x-python | PythonLexer
/ tests / test-encoding-func.py
from __future__ import absolute_import
import unittest
from mercurial import (
encoding,
)
class IsasciistrTest(unittest.TestCase):
asciistrs = [
b'a',
b'ab',
b'abc',
b'abcd',
b'abcde',
b'abcdefghi',
b'abcd\0fghi',
]
def testascii(self):
for s in self.asciistrs:
self.assertTrue(encoding.isasciistr(s))
def testnonasciichar(self):
for s in self.asciistrs:
for i in range(len(s)):
t = bytearray(s)
t[i] |= 0x80
self.assertFalse(encoding.isasciistr(bytes(t)))
class LocalEncodingTest(unittest.TestCase):
def testasciifastpath(self):
s = b'\0' * 100
self.assertTrue(s is encoding.tolocal(s))
self.assertTrue(s is encoding.fromlocal(s))
class Utf8bEncodingTest(unittest.TestCase):
def testasciifastpath(self):
s = b'\0' * 100
self.assertTrue(s is encoding.toutf8b(s))
self.assertTrue(s is encoding.fromutf8b(s))
if __name__ == '__main__':
import silenttestrunner
silenttestrunner.main(__name__)