Skip to content

Commit 41eea68

Browse files
committed
test: Fix some test issues only found by our custom tox config
1 parent ab1a778 commit 41eea68

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎tornado/test/httpclient_test.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,10 @@ def test_decompression_bomb_without_streaming_callback(self):
375375
tracemalloc.start()
376376
try:
377377
tracemalloc.reset_peak()
378-
with self.assertRaises(HTTPError):
378+
with (
379+
self.assertRaises(HTTPError),
380+
ExpectLog(gen_log, ".*decompressed body too large"),
381+
):
379382
self.fetch(
380383
"/gzip_bomb?size=%d" % UNBUFFERABLE_BOMB_SIZE, raise_error=True
381384
)

‎tornado/test/web_test.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,11 +1559,11 @@ def setUp(self):
15591559
self.outside = os.path.join(self.tmpdir, "outside")
15601560
os.mkdir(self.root)
15611561
os.mkdir(self.outside)
1562-
with open(os.path.join(self.root, "inside.txt"), "w") as f:
1562+
with open(os.path.join(self.root, "inside.txt"), "w", encoding="utf-8") as f:
15631563
f.write("inside")
1564-
with open(os.path.join(self.outside, "secret.txt"), "w") as f:
1564+
with open(os.path.join(self.outside, "secret.txt"), "w", encoding="utf-8") as f:
15651565
f.write("secret")
1566-
with open(os.path.join(self.root, "index.html"), "w") as f:
1566+
with open(os.path.join(self.root, "index.html"), "w", encoding="utf-8") as f:
15671567
f.write("root index")
15681568
# A symlink to a file outside the root.
15691569
os.symlink(
@@ -1686,7 +1686,7 @@ def setUp(self):
16861686
self.addCleanup(shutil.rmtree, self.tmpdir)
16871687
real_root = os.path.join(self.tmpdir, "real")
16881688
os.mkdir(real_root)
1689-
with open(os.path.join(real_root, "inside.txt"), "w") as f:
1689+
with open(os.path.join(real_root, "inside.txt"), "w", encoding="utf-8") as f:
16901690
f.write("inside")
16911691
# Serve through a symlink to the real directory.
16921692
self.root = os.path.join(self.tmpdir, "link")

0 commit comments

Comments
 (0)