aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_language.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-12-17 14:32:56 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-12-17 14:32:56 +1300
commit467ef0c02a6351539abdc81e4c9f15b7c583d5dc (patch)
tree2827ccf692515fee5139f558e83b0ac2eb197960 /test/test_language.py
parent8229c3884f88b140240694f9d714c179d5561b17 (diff)
parente0d376381efa3394e23ed60283dc45b7893e8e1e (diff)
downloadmitmproxy-467ef0c02a6351539abdc81e4c9f15b7c583d5dc.tar.gz
mitmproxy-467ef0c02a6351539abdc81e4c9f15b7c583d5dc.tar.bz2
mitmproxy-467ef0c02a6351539abdc81e4c9f15b7c583d5dc.zip
Merge branch 'master' of ssh.github.com:mitmproxy/pathod
Diffstat (limited to 'test/test_language.py')
-rw-r--r--test/test_language.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/test_language.py b/test/test_language.py
index 18865761..5e9176ab 100644
--- a/test/test_language.py
+++ b/test/test_language.py
@@ -95,9 +95,8 @@ class TestValueFile:
v = language.Value.parseString("<path")[0]
with tutils.tmpdir() as t:
p = os.path.join(t, "path")
- f = open(p, "wb")
- f.write("x"*10000)
- f.close()
+ with open(p, "wb") as f:
+ f.write("x" * 10000)
assert v.get_generator(dict(staticdir=t))
@@ -152,6 +151,7 @@ class TestMisc:
assert g[-1] == "x"
assert g[0:5] == "xxxxx"
assert repr(g)
+ del g # remove all references to FileGenerator instance to close the file handle.
def test_value(self):
assert language.Value.parseString("'val'")[0].val == "val"
@@ -697,7 +697,10 @@ class TestResponse:
assert r.actions[0].spec() == "pr,10"
def test_parse_stress(self):
- r = language.parse_response({}, "400:b@100g")
+ # While larger values are known to work on linux,
+ # len() technically returns an int and a python 2.7 int on windows has 32bit precision.
+ # Therefore, we should keep the body length < 2147483647 bytes in our tests.
+ r = language.parse_response({}, "400:b@1g")
assert r.length({})
def test_spec(self):