aboutsummaryrefslogtreecommitdiffstats
path: root/test/pathod
diff options
context:
space:
mode:
Diffstat (limited to 'test/pathod')
-rw-r--r--test/pathod/language/test_base.py6
-rw-r--r--test/pathod/language/test_generators.py4
-rw-r--r--test/pathod/protocols/test_http2.py2
3 files changed, 6 insertions, 6 deletions
diff --git a/test/pathod/language/test_base.py b/test/pathod/language/test_base.py
index ec460b07..910d298a 100644
--- a/test/pathod/language/test_base.py
+++ b/test/pathod/language/test_base.py
@@ -202,12 +202,14 @@ class TestMisc:
e.parseString("m@1")
s = base.Settings(staticdir=str(tmpdir))
- tmpdir.join("path").write_binary(b"a" * 20, ensure=True)
+ with open(str(tmpdir.join("path")), 'wb') as f:
+ f.write(b"a" * 20)
v = e.parseString("m<path")[0]
with pytest.raises(Exception, match="Invalid value length"):
v.values(s)
- tmpdir.join("path2").write_binary(b"a" * 4, ensure=True)
+ with open(str(tmpdir.join("path2")), 'wb') as f:
+ f.write(b"a" * 4)
v = e.parseString("m<path2")[0]
assert v.values(s)
diff --git a/test/pathod/language/test_generators.py b/test/pathod/language/test_generators.py
index dc15aaa1..6a67ab72 100644
--- a/test/pathod/language/test_generators.py
+++ b/test/pathod/language/test_generators.py
@@ -23,9 +23,7 @@ def test_filegenerator(tmpdir):
assert len(g[1:10]) == 9
assert len(g[10000:10001]) == 0
assert repr(g)
- # remove all references to FileGenerator instance to close the file
- # handle.
- del g
+ g.close()
def test_transform_generator():
diff --git a/test/pathod/protocols/test_http2.py b/test/pathod/protocols/test_http2.py
index 1c074197..c16a6d40 100644
--- a/test/pathod/protocols/test_http2.py
+++ b/test/pathod/protocols/test_http2.py
@@ -202,7 +202,7 @@ class TestApplySettings(net_tservers.ServerTestBase):
def handle(self):
# check settings acknowledgement
assert self.rfile.read(9) == codecs.decode('000000040100000000', 'hex_codec')
- self.wfile.write("OK")
+ self.wfile.write(b"OK")
self.wfile.flush()
self.rfile.safe_read(9) # just to keep the connection alive a bit longer