Short answer:
Create your test db the same way you created the one that your application already uses.
Run your tests using the keep db flag: python manage.py test --keepdb or —reuse-db in case you are using pytest
Long answer, do you really need to run tests on heroku?:
Running your tests on the same environment you have the production application is not a common approach, I don’t think you have enough reasons to do this.
Usually you run your test in a different environment (the main reason is because you want to dedicate your server resources to only serve real client requests)
First I would split my environments by responsibility.
A common practice is to have different environments with different databases
- dev: usually your local, where you develop
- staging: exactly copy of prod environment where you only have tests users.
- prod environment: This is what your real users use
Define a CiI/CD process and make the tests part of it (
CI/CD process )
Leaving some links so you can do a further research, if you have any specific question just let me know :)
Congrats for deploying your firsts deployments!
Regards,
Reddy Tintaya