I have a project where I defined a test configration in config.py
, but I'm puzzled by the following:
Many times there is a testing configuration for
config.py
being discussed in tutorials, like this oneActual testing with database is usually done on application and database defined in testclass (with or without Flask-Testing). This test setup does not make use of testing configuration from
config.py
See for example Flask-SQLAlchemy own test fixtures or some of links listed here
There is some advice about a test database being created specifically for the tests, eg from testing-with-sqlalchemy:
First, ensure you set the database URI to something other than your production database ! Second, it’s usually a good idea to create and drop your tables with each test run, to ensure clean tests
There are no tutorials that say "you do not need a testing configuration, do your test setup in your base test class". Is this something assumed?
Tst configuration
in config.py
and explicit test setup in class - are they mutually exclusive?
Or sometimes you combine the two?
P.S. Here is a list of project configurations without testing config.