Database is not reset after StaticLiveServerTestCase (Django 1.9.5)

226 views
Skip to first unread message

ankitj...@gmail.com

unread,
Sep 12, 2016, 9:36:23 AM9/12/16
to Django users
Hello,

I have a Python project that is using a Selenium script to emulate a user. I am running this script within a Django TestCase and I use the StaticLiveServerTestCase subclass to run a live Django server in the background.

I have also have other Unit Tests.

If I run all the tests together (The Unit Tests along with the Live Server Tests) using python manage.py test, all the test-cases that run after the Selenium/Live Server test case fail. Running the unit tests separately shows no failures. It seems that the database is not reset cleanly because of which the subsequent test cases cannot get the Django objects that they need to test against.

My situation is similar to the one described in this StackOverflow question here except for one difference that I face this issue even when I use django test runner.
http://stackoverflow.com/questions/32998166/with-py-test-database-is-not-reset-after-liveservertestcase

Is there a solution to this where I can run all the tests at once and also cleanly reset the database everytime? Or should I run the selenium test and the Unit tests seperately?
(I can show the code [Github] if necessary)

Thanks

Tim Graham

unread,
Sep 12, 2016, 4:38:39 PM9/12/16
to Django users
Yes, a minimal example project that demonstrates the issue would be helpful. My guess is that you have a mistake in your tests that's causing some state to leak between them.
Reply all
Reply to author
Forward
0 new messages