DatabaseError: no such table: django_session

195 views
Skip to first unread message

Charl P. Botha

unread,
Aug 27, 2011, 7:21:49 AM8/27/11
to Django: sane testing
Dear all,

I'm currently running into the following exception: "DatabaseError: no
such table: django_session" when I connect to the liveserver and try
to login to the test site during a test (see my TestSelenium below at
the raw_input()).

Which is strange, as I see the following in the captured logs:
django.db.backends: DEBUG: (0.000) CREATE TABLE "django_session" (
"session_key" varchar(40) NOT NULL PRIMARY KEY,
"session_data" text NOT NULL,
"expire_date" datetime NOT NULL
)

My invocation is as follows:
DJANGO_SETTINGS_MODULE=settings PYTHONPATH=. ~/build/tspy/bin/
nosetests --with-django --with-selenium --with-cherrypyliveserver

My test case looks as follows:

class TestSelenium(SeleniumTestCase):
def setUp(self):
# called before every test
super(TestSelenium, self).setUp()
self.u1 = User.objects.create(username='test',
password='test')

def test_ok(self):
self.selenium.open("/")
# check that the front page has correctly loaded and that the
user can login
self.assert_true(self.selenium.is_text_present("Login to
site"))
raw_input() # test waits here so I can connect to liveserver

def tearDown(self):
self.u1.delete()

Any help would be *greatly* appreciated. Eventually, I'd really like
to be able to exercise the full javascript-enabled site using
djangosanetesting and selenium!

Thanks,
Charl Botha

Almad

unread,
Aug 30, 2011, 3:55:37 AM8/30/11
to Django: sane testing
Hi,

which database backend do you use?

Also, not related to the issue, but

>     def tearDown(self):
>         self.u1.delete()

plase call super() here too, there might be some clanup involved :)

Almad
Reply all
Reply to author
Forward
0 new messages