title: testing postgres db python
body: <p>I don't understand how to test my repositories.  </p>
  
  <p>I want to be sure that I really saved object with all of it parameters into database, and when I execute my SQL statement I really received what I am supposed to.</p>
  
  <p>But, I cannot put <code>"CREATE TABLE test_table</code>" in <code>setUp</code> method of unittest case because it will be created multiple times (tests of the same testcase are runned in parallel). So, as long as I create 2 methods in the same class which needs to work on the same table, it won't work (name clash of tables)</p>
  
  <p>Same, I cannot put <code>"CREATE TABLE test_table"</code> <code>setUpModule</code>, because, now the table is created once, but since tests are runned in parallel, there is nothing which prevents from inserting the same object multiple times into my table, which breakes the unicity constraint of some field.</p>
  
  <p>Same, I cannot <code>"CREATE SCHEMA some_random_schema_name"</code> in every method, because I need to globally "SET search_path TO ..." for a given Database, so every method runned in parallel will be affected.</p>
  
  <p>The only way I see is to create to <code>"CREATE DATABASE"</code> for each  test, and with unique name, and establish a invidual connection to each database.. This looks extreeeemly wasteful. Is there a better way?</p>
  
  <p>Also, I cannot use SQLite in memory because I need to test PostgreSQL.</p>