mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Better test daemon cleanup, improve utils test coverage.
This commit is contained in:
parent
34ffe46fa0
commit
26c8437e88
@ -261,5 +261,4 @@ def make_server(application, port, address, ssl_options):
|
|||||||
def run(server):
|
def run(server):
|
||||||
tornado.ioloop.IOLoop.instance().start()
|
tornado.ioloop.IOLoop.instance().start()
|
||||||
server.stop()
|
server.stop()
|
||||||
tornado.ioloop.IOLoop.instance().close()
|
|
||||||
|
|
||||||
|
@ -67,14 +67,5 @@ class Data:
|
|||||||
raise ValueError, "dataPath: %s does not exist."%fullpath
|
raise ValueError, "dataPath: %s does not exist."%fullpath
|
||||||
return fullpath
|
return fullpath
|
||||||
|
|
||||||
def read(self, path):
|
|
||||||
"""
|
|
||||||
Returns a path to the package data housed at 'path' under this
|
|
||||||
module.Path can be a path to a file, or to a directory.
|
|
||||||
|
|
||||||
This function will raise ValueError if the path does not exist.
|
|
||||||
"""
|
|
||||||
p = self.path(path)
|
|
||||||
return open(p).read()
|
|
||||||
|
|
||||||
data = Data(__name__)
|
data = Data(__name__)
|
||||||
|
@ -5,10 +5,17 @@ from libpathod import utils
|
|||||||
class uparse_anchor_spec(libpry.AutoTree):
|
class uparse_anchor_spec(libpry.AutoTree):
|
||||||
def test_simple(self):
|
def test_simple(self):
|
||||||
assert utils.parse_anchor_spec("foo=200", {}) == ("foo", "200")
|
assert utils.parse_anchor_spec("foo=200", {}) == ("foo", "200")
|
||||||
|
libpry.raises(utils.AnchorError, utils.parse_anchor_spec, "foobar", {})
|
||||||
libpry.raises(utils.AnchorError, utils.parse_anchor_spec, "*=200", {})
|
libpry.raises(utils.AnchorError, utils.parse_anchor_spec, "*=200", {})
|
||||||
libpry.raises(utils.AnchorError, utils.parse_anchor_spec, "foo=bar", {})
|
libpry.raises(utils.AnchorError, utils.parse_anchor_spec, "foo=bar", {})
|
||||||
|
|
||||||
|
|
||||||
|
class udata_path(libpry.AutoTree):
|
||||||
|
def test_simple(self):
|
||||||
|
libpry.raises(ValueError, utils.data.path, "nonexistent")
|
||||||
|
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
|
udata_path(),
|
||||||
uparse_anchor_spec()
|
uparse_anchor_spec()
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user