diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2013-01-26 21:19:35 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2013-01-26 21:19:35 +1300 |
commit | e5b125eec8e732112af9884cf3ab35377913303a (patch) | |
tree | d39170962cce39e4c19fa97bd70057fa9a2599bc /netlib/tcp.py | |
parent | cc4867064be42409fd5fb8271901b03029b787de (diff) | |
download | mitmproxy-e5b125eec8e732112af9884cf3ab35377913303a.tar.gz mitmproxy-e5b125eec8e732112af9884cf3ab35377913303a.tar.bz2 mitmproxy-e5b125eec8e732112af9884cf3ab35377913303a.zip |
Introduce the mock module to improve unit tests.
There are a few socket corner-cases that are incredibly hard to reproduce in a
unit test suite, so we use mock to trigger the exceptions instead.
Diffstat (limited to 'netlib/tcp.py')
-rw-r--r-- | netlib/tcp.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py index 56cc0dea..a79f3ac4 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -87,6 +87,9 @@ class _FileLike: class Writer(_FileLike): def flush(self): + """ + May raise NetLibDisconnect + """ if hasattr(self.o, "flush"): try: self.o.flush() @@ -94,6 +97,9 @@ class Writer(_FileLike): raise NetLibDisconnect(str(v)) def write(self, v): + """ + May raise NetLibDisconnect + """ if v: try: if hasattr(self.o, "sendall"): |