You could use setUpClass
, see the documentation:
A class method called before tests in an individual class run.
setUpClass
is called with the class as the only argument and must be decorated as aclassmethod()
:
@classmethod
def setUpClass(cls):
...