new backend: unit test for "autocommit-like" behavior

7 views
Skip to first unread message

Mark Bucciarelli

unread,
Jun 30, 2010, 7:14:34 AM6/30/10
to django-d...@googlegroups.com
Hi,

I've been working on a Django backend for MonetDB.
I'm trying to write a unit test that verifieds I curently
have a bug in how transactions are handled.

I have a couple questions about the unit test.

Here, Simple is a model with a single field "name"
that has a unique index.

s = Simple(name='mark')
s.save()
s = Simple(name='mark')
try:
s.save()
except OperationalError:
pass

# first one should be saved.
s = Simple.objects.get(name='mark')
self.assertTrue(s is not None)

Is this test look correct?

Currently it fails on the get() with the error

current transaction is aborted
(please ROLLBACK)

I should not need to call rollbak call in the
test's except clause, right?

Thanks,

Mark

Mark Bucciarelli

unread,
Jun 30, 2010, 7:56:34 AM6/30/10
to django-d...@googlegroups.com
On Wed, Jun 30, 2010 at 7:14 AM, Mark Bucciarelli <mkb...@gmail.com> wrote:
>
> Is this test look correct?
>

It passes when using SQLite backend, so I
think the test is good.

>
> Currently it fails on the get() with the error
>
>      current transaction is aborted
>      (please ROLLBACK)
>

Any suggestions for what code is missing
from the MonetDB driver?

Thanks,

m

Reply all
Reply to author
Forward
0 new messages