mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +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]
|
[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
|
The following auxiliary components may be needed if you plan to hack on
|
||||||
mitmproxy:
|
mitmproxy:
|
||||||
|
|
||||||
* The test suite uses the [pry](http://github.com/cortesi/pry) unit testing
|
* The test suite uses the [nose](http://readthedocs.org/docs/nose/en/latest/) unit testing
|
||||||
library.
|
framework.
|
||||||
* Rendering the documentation requires [countershape](http://github.com/cortesi/countershape).
|
* Rendering the documentation requires [countershape](http://github.com/cortesi/countershape).
|
||||||
|
|
||||||
__mitmproxy__ is tested and developed on OSX, Linux and OpenBSD. Windows is not
|
__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
|
The following auxiliary components may be needed if you plan to hack on
|
||||||
mitmproxy:
|
mitmproxy:
|
||||||
|
|
||||||
* The test suite uses the pry_ unit testing
|
* The test suite uses the nose_ unit testing
|
||||||
library.
|
framework.
|
||||||
* Rendering the documentation requires countershape_.
|
* Rendering the documentation requires countershape_.
|
||||||
|
|
||||||
**mitmproxy** is tested and developed on OSX, Linux and OpenBSD. Windows is not
|
**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/
|
.. _PIL: http://www.pythonware.com/products/pil/
|
||||||
.. _lxml: http://lxml.de/
|
.. _lxml: http://lxml.de/
|
||||||
.. _urwid: http://excess.org/urwid/
|
.. _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
|
.. _countershape: http://github.com/cortesi/countershape
|
||||||
|
@ -213,10 +213,7 @@ class SSLCert:
|
|||||||
return altnames
|
return altnames
|
||||||
|
|
||||||
|
|
||||||
# begin nocover
|
def get_remote_cert(host, port): # pragma: no cover
|
||||||
def get_remote_cert(host, port):
|
|
||||||
addr = socket.gethostbyname(host)
|
addr = socket.gethostbyname(host)
|
||||||
s = ssl.get_server_certificate((addr, port))
|
s = ssl.get_server_certificate((addr, port))
|
||||||
return SSLCert(s)
|
return SSLCert(s)
|
||||||
# end nocover
|
|
||||||
|
|
||||||
|
@ -236,11 +236,10 @@ def view_javascript(hdrs, content, limit):
|
|||||||
opts.indent_size = 2
|
opts.indent_size = 2
|
||||||
try:
|
try:
|
||||||
res = jsbeautifier.beautify(content[:limit], opts)
|
res = jsbeautifier.beautify(content[:limit], opts)
|
||||||
# begin nocover
|
except: # pragma: no cover
|
||||||
except:
|
# Bugs in jsbeautifier mean that it
|
||||||
# Bugs in jsbeautifier mean that it can trhow arbitrary errors.
|
# can throw arbitrary errors.
|
||||||
return None
|
return None # pragma: no cover
|
||||||
# end nocover
|
|
||||||
return "JavaScript", _view_text(res, len(content), limit)
|
return "JavaScript", _view_text(res, len(content), limit)
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ import Queue, threading
|
|||||||
|
|
||||||
should_exit = False
|
should_exit = False
|
||||||
|
|
||||||
#begin nocover
|
|
||||||
|
|
||||||
class Msg:
|
class Msg:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.q = Queue.Queue()
|
self.q = Queue.Queue()
|
||||||
@ -36,13 +34,13 @@ class Msg:
|
|||||||
self.acked = False
|
self.acked = False
|
||||||
try:
|
try:
|
||||||
masterq.put(self, timeout=3)
|
masterq.put(self, timeout=3)
|
||||||
while not should_exit:
|
while not should_exit: # pragma: no cover
|
||||||
try:
|
try:
|
||||||
g = self.q.get(timeout=0.5)
|
g = self.q.get(timeout=0.5)
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
continue
|
continue
|
||||||
return g
|
return g
|
||||||
except (Queue.Empty, Queue.Full):
|
except (Queue.Empty, Queue.Full): # pragma: no cover
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +86,7 @@ class Master:
|
|||||||
self.tick(self.masterq)
|
self.tick(self.masterq)
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def handle(self, msg):
|
def handle(self, msg): # pragma: no cover
|
||||||
c = "handle_" + msg.__class__.__name__.lower()
|
c = "handle_" + msg.__class__.__name__.lower()
|
||||||
m = getattr(self, c, None)
|
m = getattr(self, c, None)
|
||||||
if m:
|
if m:
|
||||||
|
@ -214,13 +214,12 @@ class DumpMaster(flow.FlowMaster):
|
|||||||
self._process_flow(f)
|
self._process_flow(f)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
# begin nocover
|
def shutdown(self): # pragma: no cover
|
||||||
def shutdown(self):
|
|
||||||
if self.o.wfile:
|
if self.o.wfile:
|
||||||
self.fwriter.fo.close()
|
self.fwriter.fo.close()
|
||||||
return flow.FlowMaster.shutdown(self)
|
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.o.rfile and not self.o.keepserving:
|
||||||
if self.script:
|
if self.script:
|
||||||
self.load_script(None)
|
self.load_script(None)
|
||||||
|
@ -257,7 +257,6 @@ class FileLike:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
#begin nocover
|
|
||||||
class RequestReplayThread(threading.Thread):
|
class RequestReplayThread(threading.Thread):
|
||||||
def __init__(self, config, flow, masterq):
|
def __init__(self, config, flow, masterq):
|
||||||
self.config, self.flow, self.masterq = config, flow, masterq
|
self.config, self.flow, self.masterq = config, flow, masterq
|
||||||
|
@ -82,7 +82,7 @@ class TestDumpMaster:
|
|||||||
|
|
||||||
libpry.raises(
|
libpry.raises(
|
||||||
dump.DumpError, self._dummy_cycle,
|
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):
|
def test_options(self):
|
||||||
|
@ -595,7 +595,7 @@ class TestFlowMaster:
|
|||||||
err = flow.Error(f.request, "msg")
|
err = flow.Error(f.request, "msg")
|
||||||
fm.handle_error(err)
|
fm.handle_error(err)
|
||||||
|
|
||||||
fm.load_script("scripts/a.py")
|
fm.load_script(tutils.test_data.path("scripts/a.py"))
|
||||||
fm.shutdown()
|
fm.shutdown()
|
||||||
|
|
||||||
def test_client_playback(self):
|
def test_client_playback(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user