Open drjasonharrison opened 3 years ago
Hi! Sorry for the late answer. I haven't reviewed that post for a long time. Can you please elaborate, I'm not sure I follow exactly which pytest discussion you are referring to in that post. Thanks!
In your other discussion on TDD, you covered patching, which is just about the only way to test a Singleton class when it is used by another class. https://www.thedigitalcatonline.com/blog/2020/09/21/tdd-in-python-with-pytest-part-5/
In trying to write tests for a Singleton class I found that most of the discussions about TDD and most of the discussions about Singletons there was either very poor or no discussion of how to test a class that relies on a singleton class.
It would be really helpful if the the pytest discussion pages included how to test a class that inherits from your metaclass=Singleton. This is an often ignored challenge in pytest, and Singleton, discussions.
https://www.thedigitalcatonline.com/blog/2014/09/01/python-3-oop-part-5-metaclasses/