I had similar problem - so if this helps anyone:
My tests started to give me this error and I was quite confused since I thought that nothing changed in my tests.
If I'm not mistaken at some point the order of test execution changed and my test data (fixtures) got all messed up, some assuming that hard coded IDs exist in my database.
Then I checked if it is possible to reset postgres serials between test cases and it indeed is: How can I reset a Django test database id's after each test?