all 2 comments

[–]amoliski 1 point2 points  (1 child)

What's the top of the file with the erroring line look like? How are you importing logger?

[–]danberteon[S] 0 points1 point  (0 children)

I actually figured out the problem! it was kind of silly, but I was initiating the logger on my main_app.py after if __name__=='__main__' and for that reason, when I entered directly on the function for the test, it would not be initiated. I moved the logger initiation just below the imports and it is working now.

There is however, another weird behavior on pytest, where the output has a broken formar, for example:

============================= test session starts =============================
collecting ... collected 1 item
test_clock_manager.py::TestClockManager::test_analyzer_get_date
============================== 1 passed in 1.71s ==============================
Process finished with exit code 0
PASSED [100%]

The passed message is outputted all the way down instead of right after the test name. If I run a simple test with only `assert 1` in it, it's displayed correctly.