Tag: docker

Testing Django with docker-compose and Postgresql

At the moment it’s pretty common to have following setup for local development- docker-compose simulation production setup with application, database and all other containers needed to run the app- sometimes even with nginx. This is a good pattern to have local setup as close to production as possible. However, running unit/integration tests in this case may be just slow- slowest part of testing is communication with DB and usually it’s avoided by testing with in-memory sqlite. What if you can’t use in-memory sqlite database because you’re tied to database specific functions? You can mock your tests to avoid any DB usage and this is the most performant way but also forces you not to test anything that is returned by database- so integration tests can’t be really run this way.

Continue reading