On Thu, May 14, 2009 at 02:18:47PM +0000, Matthew Wilson wrote:
> I'm trying to write a test, but it seems like all the tests use a sqlite
> database, and sqlite doesn't support an interval datatype.
>
> Not sure what to do at this point. Here's the test (absolutely
> nothing fancy here):
>
> $ cat test_interval.py
> # vim: set expandtab ts=4 sw=4 filetype=python:
>
> from datetime import timedelta
>
> from sqlobject import *
> from sqlobject.tests.dbtest import *
>
> class Student(SQLObject):
> break_time = TimedeltaCol()
>
> def test_timedeltaCol():
> setupClass(Student)
> td = timedelta(seconds=60*60)
> student = Student(break_time=td)
> assert student.break_time == td
>
> When I run py.test test_interval.py, I get an operational error that
> comes from sqlite rejecting the interval syntax.
>
> Ideas? Should I create a postgresql database in my setup method and
> then connect to that for my test?
It should be something like
$ createdb test
$ py.test test_interval.py -D postgres:/test
$ dropdb test
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|