Dry-run as a term is definitely ok. Still I think this kind of testing - with manually commenting in and out certain lines - is not state-of-the-art anymore. The better alternative is to embed the code into a function where can control whether the deletion happens or not, i.e.:
def delete_files(file_paths,log_only=False) for file_path in file_paths: if log_only: print('deleting', file_path) ' or log somewhere else else: delete(file_path)
One can call this function inside an automated test (with log_only set to True, and some extra code to validate only the correct files will be deleted). Such a test is something I would call a unit test with disabled file system access, or maybe a unit test in dry-run mode.
As mentioned by @chepner in a comment, a more streamlined approach is to provide the delete function as a parameter:
def delete_files(file_paths,delete_func=delete) for file_path in file_paths: delete_func(file_path)
In unit tests, just call
delete_files(file_paths,lambda x:print('deleting', x))
or, even better, pass a function which collects the file names in a list, so it will be easy to check the content of the list afterwards.
(I did not test this code, hope I got the Python syntax right).