The problem is as follows. I can not set up a test environment in a Flask application with peewee orm.
I tried to install models Proxy db
import peewee DATABASE_DATA = { 'database': 'plan', 'user': 'plan', 'password': 'plan' } TEST_DATABASE_DATA = { 'database': 'plan_test', 'user': 'plan', 'password': 'plan' } proxy_db = peewee.Proxy() class PlanModel(peewee.Model): class Meta: database = peewee.Proxy() def set_database(testing_mode=False): if testing_mode: db_data = TEST_DATABASE_DATA else: db_data = DATABASE_DATA db = peewee.PostgresqlDatabase(db_data) proxy_db.initialize(db) return db
, but I get in the endAttributeError: Cannot use uninitialized Proxy
Maybe you have some cookbook on this topic. I also do not understand how they run in flask, the code of the type below is not at all clear to me
unittest.main()