Remove dependence on pathod in test suite.

This commit is contained in:
Aldo Cortesi
2015-06-23 22:16:03 +12:00
parent 5588e57ca4
commit 239f4758af
2 changed files with 21 additions and 3 deletions

View File

@@ -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

View File

@@ -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):