diff options
author | Maximilian Hils <git@maximilianhils.com> | 2013-12-15 02:43:16 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2013-12-15 02:43:16 +0100 |
commit | 605950bfdf221854b2b0fc4b875777891d90f34b (patch) | |
tree | 6506a79c8dd863332b4c0d54b634141939184284 /test/tutils.py | |
parent | 224cd41dc268e7620d57ffb19dc5e7bc8c231f84 (diff) | |
download | mitmproxy-605950bfdf221854b2b0fc4b875777891d90f34b.tar.gz mitmproxy-605950bfdf221854b2b0fc4b875777891d90f34b.tar.bz2 mitmproxy-605950bfdf221854b2b0fc4b875777891d90f34b.zip |
add @concurrent decorator for inline scripts, fixes #176
Diffstat (limited to 'test/tutils.py')
-rw-r--r-- | test/tutils.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test/tutils.py b/test/tutils.py index e42256ed..4cd7b7f8 100644 --- a/test/tutils.py +++ b/test/tutils.py @@ -33,6 +33,13 @@ def tresp(req=None): resp.reply = controller.DummyReply() return resp +def terr(req=None): + if not req: + req = treq() + err = flow.Error(req, "error") + err.reply = controller.DummyReply() + return err + def tflow(): r = treq() @@ -40,21 +47,17 @@ def tflow(): def tflow_full(): - r = treq() - f = flow.Flow(r) - f.response = tresp(r) + f = tflow() + f.response = tresp(f.request) return f def tflow_err(): - r = treq() - f = flow.Flow(r) - f.error = flow.Error(r, "error") - f.error.reply = controller.DummyReply() + f = tflow() + f.error = terr(f.request) return f - @contextmanager def tmpdir(*args, **kwargs): orig_workdir = os.getcwd() |