def datadir(tmpdir, request):
'''
Fixture responsible for locating the test data directory and copying it
into a temporary directory.
'''
filename = request.module.__file__
test_dir = os.path.dirname(filename)
data_dir = os.path.join(test_dir, 'data')
dir_util.copy_tree(data_dir, str(tmpdir))
def getter(filename, as_str=True):
filepath = tmpdir.join(filename)
if as_str:
return str(filepath)
return filepath
return getter
评论列表
文章目录