mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-28 12:15:00 +08:00
Remove dependence on pathod in test suite.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from __future__ import (absolute_import, print_function, division)
|
||||
|
||||
import os.path
|
||||
|
||||
def isascii(s):
|
||||
try:
|
||||
@@ -110,3 +110,22 @@ def pretty_size(size):
|
||||
if x == int(x):
|
||||
x = int(x)
|
||||
return str(x) + suf
|
||||
|
||||
|
||||
class Data(object):
|
||||
def __init__(self, name):
|
||||
m = __import__(name)
|
||||
dirname, _ = os.path.split(m.__file__)
|
||||
self.dirname = os.path.abspath(dirname)
|
||||
|
||||
def path(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.
|
||||
"""
|
||||
fullpath = os.path.join(self.dirname, path)
|
||||
if not os.path.exists(fullpath):
|
||||
raise ValueError("dataPath: %s does not exist." % fullpath)
|
||||
return fullpath
|
||||
|
||||
@@ -3,9 +3,8 @@ import tempfile
|
||||
import os
|
||||
import shutil
|
||||
from contextlib import contextmanager
|
||||
from libpathod import utils
|
||||
|
||||
from netlib import tcp
|
||||
from netlib import tcp, utils
|
||||
|
||||
|
||||
def treader(bytes):
|
||||
|
||||
Reference in New Issue
Block a user