Nose mopup: docs, no cover pragmas, a few missing path specs.

This commit is contained in:
Aldo Cortesi 2012-06-09 13:55:55 +12:00
parent b7b357528c
commit 22192d1a46
10 changed files with 19 additions and 26 deletions

View File

@ -1,2 +1,3 @@
[report]
omit = *contrib*
omit = *contrib*, *tnetstring*
include = *libmproxy*

View File

@ -58,8 +58,8 @@ Requirements
The following auxiliary components may be needed if you plan to hack on
mitmproxy:
* The test suite uses the [pry](http://github.com/cortesi/pry) unit testing
library.
* The test suite uses the [nose](http://readthedocs.org/docs/nose/en/latest/) unit testing
framework.
* Rendering the documentation requires [countershape](http://github.com/cortesi/countershape).
__mitmproxy__ is tested and developed on OSX, Linux and OpenBSD. Windows is not

View File

@ -57,8 +57,8 @@ Requirements
The following auxiliary components may be needed if you plan to hack on
mitmproxy:
* The test suite uses the pry_ unit testing
library.
* The test suite uses the nose_ unit testing
framework.
* Rendering the documentation requires countershape_.
**mitmproxy** is tested and developed on OSX, Linux and OpenBSD. Windows is not
@ -80,5 +80,5 @@ following:
.. _PIL: http://www.pythonware.com/products/pil/
.. _lxml: http://lxml.de/
.. _urwid: http://excess.org/urwid/
.. _pry: http://github.com/cortesi/pry
.. _nose: http://readthedocs.org/docs/nose/en/latest/
.. _countershape: http://github.com/cortesi/countershape

View File

@ -213,10 +213,7 @@ class SSLCert:
return altnames
# begin nocover
def get_remote_cert(host, port):
def get_remote_cert(host, port): # pragma: no cover
addr = socket.gethostbyname(host)
s = ssl.get_server_certificate((addr, port))
return SSLCert(s)
# end nocover

View File

@ -236,11 +236,10 @@ def view_javascript(hdrs, content, limit):
opts.indent_size = 2
try:
res = jsbeautifier.beautify(content[:limit], opts)
# begin nocover
except:
# Bugs in jsbeautifier mean that it can trhow arbitrary errors.
return None
# end nocover
except: # pragma: no cover
# Bugs in jsbeautifier mean that it
# can throw arbitrary errors.
return None # pragma: no cover
return "JavaScript", _view_text(res, len(content), limit)

View File

@ -17,8 +17,6 @@ import Queue, threading
should_exit = False
#begin nocover
class Msg:
def __init__(self):
self.q = Queue.Queue()
@ -36,13 +34,13 @@ class Msg:
self.acked = False
try:
masterq.put(self, timeout=3)
while not should_exit:
while not should_exit: # pragma: no cover
try:
g = self.q.get(timeout=0.5)
except Queue.Empty:
continue
return g
except (Queue.Empty, Queue.Full):
except (Queue.Empty, Queue.Full): # pragma: no cover
return None
@ -88,7 +86,7 @@ class Master:
self.tick(self.masterq)
self.shutdown()
def handle(self, msg):
def handle(self, msg): # pragma: no cover
c = "handle_" + msg.__class__.__name__.lower()
m = getattr(self, c, None)
if m:

View File

@ -214,13 +214,12 @@ class DumpMaster(flow.FlowMaster):
self._process_flow(f)
return f
# begin nocover
def shutdown(self):
def shutdown(self): # pragma: no cover
if self.o.wfile:
self.fwriter.fo.close()
return flow.FlowMaster.shutdown(self)
def run(self):
def run(self): # pragma: no cover
if self.o.rfile and not self.o.keepserving:
if self.script:
self.load_script(None)

View File

@ -257,7 +257,6 @@ class FileLike:
return result
#begin nocover
class RequestReplayThread(threading.Thread):
def __init__(self, config, flow, masterq):
self.config, self.flow, self.masterq = config, flow, masterq

View File

@ -82,7 +82,7 @@ class TestDumpMaster:
libpry.raises(
dump.DumpError, self._dummy_cycle,
0, None, "", verbosity=1, rfile="test_dump.py"
0, None, "", verbosity=1, rfile=tutils.test_data.path("test_dump.py")
)
def test_options(self):

View File

@ -595,7 +595,7 @@ class TestFlowMaster:
err = flow.Error(f.request, "msg")
fm.handle_error(err)
fm.load_script("scripts/a.py")
fm.load_script(tutils.test_data.path("scripts/a.py"))
fm.shutdown()
def test_client_playback(self):