Answer the question
In order to leave comments, you need to log in
How to avoid calling setUp for each test separately?
I have a suite of thousands of tests that looks something like this:
class OneOfTheBaseTest:
def setUp(self):
# prepare db
self.create_test_data_method_1()
self.create_test_data_method_2()
...
self.create_test_data_method_99()
class TestCase_1(..., OneOfTheBaseTest):
def setUp(self):
# do something
super().setUp()
# do something more
def test_00_test_some_things(self):
# tests
...
def test_99_test_other_thigns(self):
# tests
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question