For context, I have a CustomLogger class that has a method using the @classmethod decorator. When this method is invoked, it creates a session to connect with the database and then writes the logs to the database.
I also have a test written for this method where I'm mocking the content of the log and mocking the database connection.
Tests are executed on a Docker Container that is raised on conftest.py and I have a function that provides Session objects connecting to that test database. With all my other tests, this works and I can debug them, even see the data going in on the database running inside the Docker Container.
But with the tests for the CustomLogger class, I can't debug them if I use unittest.mock.patch to mock the database connection.
(will provide code samples below)