aboutsummaryrefslogtreecommitdiffstats
path: root/pathod/test.py
diff options
context:
space:
mode:
authorharsh vijay <iharsh234@gmail.com>2017-05-02 05:19:25 +0530
committerGitHub <noreply@github.com>2017-05-02 05:19:25 +0530
commite24b4cc1b64455b8b9b5d1265103054bb8b3a8af (patch)
treee7e9474787505ffbaa348fbd0235529adb74f0e7 /pathod/test.py
parent53ad658e9f59743b72cb234f9b160aa6dc3d1f72 (diff)
downloadmitmproxy-e24b4cc1b64455b8b9b5d1265103054bb8b3a8af.tar.gz
mitmproxy-e24b4cc1b64455b8b9b5d1265103054bb8b3a8af.tar.bz2
mitmproxy-e24b4cc1b64455b8b9b5d1265103054bb8b3a8af.zip
Extend Mypy checking to pathod
* mypy checking pathod * initial commit , fixed errors * tox: mypy checking to pathod * Fixed mypy test failed * issue was with args in custom_contentview.py * tox: mypy checking to #2221 * follow-import=skip since we cant provide args to custom_contentview.py during mypy testing * Lint , Typo Fixed * code style: module import
Diffstat (limited to 'pathod/test.py')
-rw-r--r--pathod/test.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/pathod/test.py b/pathod/test.py
index 81f5805f..52f3ba02 100644
--- a/pathod/test.py
+++ b/pathod/test.py
@@ -1,16 +1,16 @@
import io
import time
import queue
-
from . import pathod
from mitmproxy.types import basethread
+import typing # noqa
class Daemon:
IFACE = "127.0.0.1"
- def __init__(self, ssl=None, **daemonargs):
- self.q = queue.Queue()
+ def __init__(self, ssl=None, **daemonargs) -> None:
+ self.q = queue.Queue() # type: queue.Queue
self.logfp = io.StringIO()
daemonargs["logfp"] = self.logfp
self.thread = _PaThread(self.IFACE, self.q, ssl, daemonargs)
@@ -25,18 +25,18 @@ class Daemon:
def __enter__(self):
return self
- def __exit__(self, type, value, traceback):
+ def __exit__(self, type, value, traceback) -> bool:
self.logfp.truncate(0)
self.shutdown()
return False
- def p(self, spec):
+ def p(self, spec: str) -> str:
"""
Return a URL that will render the response in spec.
"""
return "%s/p/%s" % (self.urlbase, spec)
- def text_log(self):
+ def text_log(self) -> str:
return self.logfp.getvalue()
def wait_for_silence(self, timeout=5):
@@ -62,7 +62,7 @@ class Daemon:
return None
return l[-1]
- def log(self):
+ def log(self) -> typing.List[typing.Dict]:
"""
Return the log buffer as a list of dictionaries.
"""