For my tests I created a method in the init.py file that I include in a lot of tests. Besides the fact that it seems to work pylint shows that the instance of the test class has no member floor.
init.py
def create_floor(self):
self.floor = Floor.objects.create(level=0)
...
test_something.py
def setUp(self):
create_floor(self)
self.building = Building.objects.create(floor=self.floor)
...
Aucun commentaire:
Enregistrer un commentaire