Jan-07-2020, 10:00 AM
I'm glad you're looking into unit testing. I've not used pytest, but I suspect it has functionality to mark a function to be run before tests and after tests so you can do the setting up and clearing up in that way (it's common to want to do that, so I'd be surprised if pytest didn't have such facilities).
As for creating the files and folders in the first place, take a look at this - the
As for creating the files and folders in the first place, take a look at this - the
tempfile
module has facilities to create temporary files. If you're on Unix, then look at the os
module (not listed in the link because its scope is more general than just the file system) which has a chmod
function for setting permissions (I don't know what one would do on Windows I'm afraid!).