I am using to run tests for my django application pytest with pytest-django plugin. I use MySQL database as a default one for django. Is there possiblity to specify just for pytest to use different database for tests, SQLite?
I am looking for different option if any, than creating special test_seetings.py for py.test –ds=test_settings.
--ds=test_settingsis the way to go!If you dont want to type out
--ds=...every time you invoke py.test, you can add a pytest.ini with this contents:As a side note: It is good practice to use the same type of database that you use in production when running your tests. pytest-django provides the
--reuse-dboption to re-use a MySQL/Postgres database between test runs, saving a lot of setup time when running a few tests for projects with lots of models.