Skip to content

Instantly share code, notes, and snippets.

@Matt3o12
Matt3o12 / readme.md
Last active August 29, 2015 14:04
This test case creates a remote PostreSQL database provided by [postgression.com](http://postgression.com) and saves the credentials in order to limit the databases needed for testing.

What does this TestCase

This test case creates a remote PostreSQL database provided by postgression.com. postgression.com provides you with a PostgreSQL database, so you don't need to set up a PostgreSQL server on your local machine.
Unfortunately, PostgreSQL only provides you with 100 Database per hour, which can be reached very quickly when running lots of tests at the same time. This is where this DatabaseTestCase comes into place. It stores information about the last database used on your machine and reuses it so you won't reach the limit of 100 database.

How do I install/implement this?

Just copy the TestCase class somewhere in your tests folder. Then import the class. Let's say you have a file called setupTests.py in the test folder, the you would have to write:

from .setupTests import DatabaseTestCase

class MyTests(DatabaseTestCase):