From 1fe1a802adbef93b5b024a85d8dafb112ed652bb Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 3 Mar 2013 12:16:09 +1300 Subject: [PATCH] 100% test coverage. --- netlib/http_auth.py | 2 +- netlib/tcp.py | 2 +- test/test_http.py | 1 + test/test_imports.py | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 test/test_imports.py diff --git a/netlib/http_auth.py b/netlib/http_auth.py index d478ab1..4adae17 100644 --- a/netlib/http_auth.py +++ b/netlib/http_auth.py @@ -96,7 +96,7 @@ def __init__(self, fp): salt = parts[2], hashed_password = parts[3] ) - + def test(self, username, password_token): ui = self.usernames.get(username) if not ui: diff --git a/netlib/tcp.py b/netlib/tcp.py index 485d821..07b28cf 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -298,7 +298,7 @@ def finish(self): self.close() self.wfile.close() self.rfile.close() - except socket.error: + except (socket.error, NetLibDisconnect): # Remote has disconnected pass diff --git a/test/test_http.py b/test/test_http.py index 1c89900..05dfdb8 100644 --- a/test/test_http.py +++ b/test/test_http.py @@ -2,6 +2,7 @@ from netlib import http, odict import tutils + def test_httperror(): e = http.HttpError(404, "Not found") assert str(e) diff --git a/test/test_imports.py b/test/test_imports.py new file mode 100644 index 0000000..7b8a643 --- /dev/null +++ b/test/test_imports.py @@ -0,0 +1,3 @@ +# These are actually tests! +import netlib.http_status +import netlib.version