mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
Nose mopup: docs, no cover pragmas, a few missing path specs.
This commit is contained in:
parent
b7b357528c
commit
22192d1a46
@ -1,2 +1,3 @@
|
||||
[report]
|
||||
omit = *contrib*
|
||||
omit = *contrib*, *tnetstring*
|
||||
include = *libmproxy*
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user