aboutsummaryrefslogtreecommitdiffstats
path: root/test/pathod/language
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2017-05-24 14:09:41 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2017-05-24 14:09:41 +0200
commitae7e9efb5ca014291e879694414bbffc982f2a0d (patch)
tree6ada273eb6d6f0cc9cf04a9d002ee8481d9cce41 /test/pathod/language
parent2faaa0b2a23089b9ffccf2d46dc42328edb76ddd (diff)
downloadmitmproxy-ae7e9efb5ca014291e879694414bbffc982f2a0d.tar.gz
mitmproxy-ae7e9efb5ca014291e879694414bbffc982f2a0d.tar.bz2
mitmproxy-ae7e9efb5ca014291e879694414bbffc982f2a0d.zip
fix various fd/socket leaks
Diffstat (limited to 'test/pathod/language')
-rw-r--r--test/pathod/language/test_base.py6
-rw-r--r--test/pathod/language/test_generators.py4
2 files changed, 5 insertions, 5 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():