-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I've had a few times come up now where I wanted to create a regular file and an image to test some server code, I've had to do something like this each time:
dirpath = testdata.create_files({
"foo.txt": "this is foo.txt",
"bar/che.txt": "this is che.txt",
})
imagepath = testdata.create_jpg("baz.jpg", dirpath)
server = testdata.create_fileserver({}, dirpath)There are couple ways this could be better, one is I could have the file dict take a callback as the value, which would take the path and the base directory, so something like this:
def create_image(path, tmpdir):
return testdata.create_jpg(path, tmpdir)
testdata.create_files({
"foo.jpg": create_image
})It would also be nice if anything that took a file_dict could also just take a Dirpath instance and use that as tmpdir:
basedir = testdata.create_files({
"foo.jpg": testdata.create_jpg
})
server = testdata.create_fileserver(basedir)I think adding both of these will make the file creation interface more fluid
Metadata
Metadata
Assignees
Labels
No labels