Staging
v0.5.1
v0.5.1
https://github.com/python/cpython
Revision 9eb3d5463976068900e94b860ced7e035885835c authored by Steve Dower on 21 August 2019, 22:52:42 UTC, committed by GitHub on 21 August 2019, 22:52:42 UTC
bpo-37834: Normalise handling of reparse points on Windows * ntpath.realpath() and nt.stat() will traverse all supported reparse points (previously was mixed) * nt.lstat() will let the OS traverse reparse points that are not name surrogates (previously would not traverse any reparse point) * nt.[l]stat() will only set S_IFLNK for symlinks (previous behaviour) * nt.readlink() will read destinations for symlinks and junction points only bpo-1311: os.path.exists('nul') now returns True on Windows * nt.stat('nul').st_mode is now S_IFCHR (previously was an error)
1 parent c30c869
Tip revision: 9eb3d5463976068900e94b860ced7e035885835c authored by Steve Dower on 21 August 2019, 22:52:42 UTC
bpo-37834: Normalise handling of reparse points on Windows (GH-15370)
bpo-37834: Normalise handling of reparse points on Windows (GH-15370)
Tip revision: 9eb3d54
test_cgitb.py
from test.support import temp_dir
from test.support.script_helper import assert_python_failure
import unittest
import sys
import cgitb
class TestCgitb(unittest.TestCase):
def test_fonts(self):
text = "Hello Robbie!"
self.assertEqual(cgitb.small(text), "<small>{}</small>".format(text))
self.assertEqual(cgitb.strong(text), "<strong>{}</strong>".format(text))
self.assertEqual(cgitb.grey(text),
'<font color="#909090">{}</font>'.format(text))
def test_blanks(self):
self.assertEqual(cgitb.small(""), "")
self.assertEqual(cgitb.strong(""), "")
self.assertEqual(cgitb.grey(""), "")
def test_html(self):
try:
raise ValueError("Hello World")
except ValueError as err:
# If the html was templated we could do a bit more here.
# At least check that we get details on what we just raised.
html = cgitb.html(sys.exc_info())
self.assertIn("ValueError", html)
self.assertIn(str(err), html)
def test_text(self):
try:
raise ValueError("Hello World")
except ValueError as err:
text = cgitb.text(sys.exc_info())
self.assertIn("ValueError", text)
self.assertIn("Hello World", text)
def test_syshook_no_logdir_default_format(self):
with temp_dir() as tracedir:
rc, out, err = assert_python_failure(
'-c',
('import cgitb; cgitb.enable(logdir=%s); '
'raise ValueError("Hello World")') % repr(tracedir))
out = out.decode(sys.getfilesystemencoding())
self.assertIn("ValueError", out)
self.assertIn("Hello World", out)
self.assertIn("<strong><module></strong>", out)
# By default we emit HTML markup.
self.assertIn('<p>', out)
self.assertIn('</p>', out)
def test_syshook_no_logdir_text_format(self):
# Issue 12890: we were emitting the <p> tag in text mode.
with temp_dir() as tracedir:
rc, out, err = assert_python_failure(
'-c',
('import cgitb; cgitb.enable(format="text", logdir=%s); '
'raise ValueError("Hello World")') % repr(tracedir))
out = out.decode(sys.getfilesystemencoding())
self.assertIn("ValueError", out)
self.assertIn("Hello World", out)
self.assertNotIn('<p>', out)
self.assertNotIn('</p>', out)
if __name__ == "__main__":
unittest.main()
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...