Python module to make testing easier, it can generate random data like names and text, run commands, fetch urls, create files and directories, and more
MIT License
10
stars
0
forks
source link
Better interface for creating different types of files #89
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:
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:
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:
It would also be nice if anything that took a
file_dict
could also just take aDirpath
instance and use that as tmpdir:I think adding both of these will make the file creation interface more fluid