Django tests – a test in classA fail when i run classB (which is subclass of classA)

As you’re figuring out, repetition is good in tests. Abstracting tests only complicates debugging and when something breaks, the last thing you want to do is debug your test before you can debug your problem.

That said, if you have shared functionality, make sure they don’t generate data and if they do that they clean up after themselves. In your oversimplified case that’s not obvious, but if you share setUpClass or setUpTestData or fixtures class attributes, you’re likely to run into trouble.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top