def _data_dir_copy(
# The name of the subdirectory located in data/name to copy.
subdir_name,
# The tmpdir object for this test. See
# https://pytest.org/latest/tmpdir.html.
tmpdir):
# Form the source and tmp paths.
source_data_dir = py.path.local(_DATA_DIR).join(subdir_name)
tmp_data_dir = tmpdir.join('data', subdir_name)
# Copy the data.
shutil.copytree(source_data_dir.strpath, tmp_data_dir.strpath)
# Return the temporary data directory, so that the copied data can now be
# used.
return tmp_data_dir
# Define a fixure for the DataDir object.
评论列表
文章目录