how to unittest in python for a logger function

I am new to unit testing in Python, So I am thinking to start with this snippet, how I can unit test this function? def log(): log_formatter = logging.Formatter(‘%(asctime)s %(levelname)s %(funcName)s(%(lineno)d) %(message)s’) logFile = ‘./df_logger.log’ handler = RotatingFileHandler(logFile, mode=’a’, maxBytes=1*1024*1024*1024, backupCount=2, encoding=None, delay=0) console_handler = logging.StreamHandler(sys.stdout) console_handler.setFormatter(log_formatter) handler.setFormatter(log_formatter) handler.setLevel(logging.INFO) logger = logging.getLogger(‘root’) logger.setLevel(logging.INFO) logger.addHandler(handler) logger.addHandler(console_handler)…

Details

Will not accept path with underscores in filename

I am trying to add an attachment to an outlook email. My code will not accept “attachment1” but “attachment2″ is working fine. The only difference is the filename: Filename_YYY_Week_xx.xlsx” Filename.xlsx” Isn’t it allowed to have underscores in filename? import win32com.client as win32 import os outlook = win32.Dispatch(‘outlook.application’) mail = outlook.CreateItem(0) mail.To = “[email protected]” mail.Subject =…

Details