Sorry not exactly an answer but maybe just use a second database only for testing? (DBNameDEV and DBNamePROD)
In c# you can use #if debug:... for loading different configurations depending if youre in debug or actually running the program. Maybe in python if debug:... would be the equivalent or something similar