From 962a414327d93b604a59a4b8c8582d359745009d Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 24 Oct 2014 14:01:34 +1300 Subject: Fix tests, re-add scripts --- test/tutils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'test/tutils.py') diff --git a/test/tutils.py b/test/tutils.py index 2c3a2c9d..94c1ff9d 100644 --- a/test/tutils.py +++ b/test/tutils.py @@ -1,4 +1,6 @@ -import tempfile, os, shutil +import tempfile +import os +import shutil from contextlib import contextmanager from libpathod import utils, test, pathoc, pathod import requests @@ -11,6 +13,7 @@ class DaemonTests: timeout = None hexdump = False ssloptions = None + @classmethod def setUpAll(self): opts = self.ssloptions or {} @@ -45,7 +48,13 @@ class DaemonTests: def getpath(self, path, params=None): scheme = "https" if self.ssl else "http" return requests.get( - "%s://localhost:%s/%s"%(scheme, self.d.port, path), verify=False, params=params + "%s://localhost:%s/%s"%( + scheme, + self.d.port, + path + ), + verify=False, + params=params ) def get(self, spec): -- cgit v1.2.3 From 00d0ee5ad56d8243b1e9bfffec9a941e11359d2c Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 25 Oct 2014 15:30:54 +1300 Subject: Parse patterns eagerly on instantiation --- test/tutils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test/tutils.py') diff --git a/test/tutils.py b/test/tutils.py index 94c1ff9d..5876e5e6 100644 --- a/test/tutils.py +++ b/test/tutils.py @@ -1,10 +1,12 @@ import tempfile import os +import re import shutil from contextlib import contextmanager -from libpathod import utils, test, pathoc, pathod +from libpathod import utils, test, pathoc, pathod, language import requests + class DaemonTests: noweb = False noapi = False @@ -22,7 +24,9 @@ class DaemonTests: so = pathod.SSLOptions(**opts) self.d = test.Daemon( staticdir=test_data.path("data"), - anchors=[("/anchor/.*", "202:da")], + anchors=[ + (re.compile("/anchor/.*"), language.parse_response("202:da")) + ], ssl = self.ssl, ssloptions = so, sizelimit=1*1024*1024, -- cgit v1.2.3