I am testing the logger's functionality and it requires me to create a log file, but at the end I want to remove it so I tried to os.remove
in the tearDownClass
@classmethod
def tearDownClass(cls) -> None:
log = logging.getLogger('client_logger')
try:
log.removeHandler(log.handlers.pop())
except:
pass
os.remove('client_logger.log')
I read that the RotatingFileHandler
is the cause of it and once I remove it the handler list is empty, but it still gives me PermissionError: [WinError 32]
.