Lets say I have a function that gets a list of what files to send that are later send over a socket to some other pc. Now usually I keep track of what files have been sent and don't send these files again. For easier coding and debugging I have this:
if debug: files_to_send = os.listdir() files_to_send.remove(files_sent_log)
otherwise I would have to delete the log every time I want to rerun the program.
Another example: Usually I would want the files to be deleted after they are on the receiving end. But for debugging I want them to stay on the sender, for this I use:
if not debug: os.remove(file)
Now my question is should I test this? My intuition is no, since it is only used to help me but not used later when the customer uses the code.
I am using python and this code stays in the production version and can be toggled with a flag in a config file. That's also partly the idea to have only important messages in the log when debug is off and a lot of debug messages when it is on.