basdijkstra / ota-examples

Code examples for the blog posts on https://www.ontestautomation.com
39 stars 52 forks source link

the python-tdd-singleton tests fail with only the first passing #2

Open drjasonharrison opened 3 years ago

drjasonharrison commented 3 years ago

I think you need a tearDown() function because running pytest on the python-tdd-singleton example results in

FAILED tests/my_singleton_test.py::test_singleton_retains_initial_property_values_after_subsequent_init_calls - RuntimeError: Already instantiated!
FAILED tests/my_singleton_test.py::test_singleton_instance_is_accessible_using_class_method - RuntimeError: Already instantiated!
FAILED tests/my_singleton_test.py::test_singleton_instance_field_is_not_directly_accessible - RuntimeError: Already instantiated!

But they all pass when run independently.

basdijkstra commented 3 years ago

Probably. Those tests were written iteratively (following the blog post), I don't think I've even tried to run them all together (or I would have noticed). Thank you for the suggestion!