I have a problem with generating log files while using the test runner and I can't wrap my head around it. Basically, if execute my test function with pytest, no log file is created. If I run the function as a script call (so normal run module, without "pytest for ...") the logging file is generated as expected.
As you can see in the example below it is not a complicated logger. I assume the problem has something to do with the pytest configuration but I just don't understand what is going wrong here.
LOG_PATH = os.path.join(os.getcwd(), 'log')
if not os.path.exists(LOG_PATH):
now = datetime.datetime.now()
filename = os.path.join(LOG_PATH, 'log-'+now.strftime("%Y-%m-%d %H-%M")+'.log')
format='%(asctime)s - %(levelname)s - %(message)s',
logger = logging.getLogger()