I write testing code using flask_testing
following is my testing code
from app import create_app, db
class SampleTest(TestCase):
def create_app(self):
self.db_fd, self.db_path = tempflie.mkstemp()
return create_app({'DATABASE': self.db_path})
def setUp(self):
db.create_all()
def tearDown(self):
db.session.remove()
db.drop_all()
os.close(self.db_fd)
os.unlink(self.db_path)
def test1(self):
response = self.get('/test1/')
def test2(self):
response = self.get('/test2/')
when I debug the test code, I found that create_app is called in all test functions, including test1, test.
how can i call create_app function only once?