Hello!

On Tue, Sep 26, 2006 at 12:54:35PM -0400, Nathan Edwards wrote:
> py.test -D "sqlite:///tmp/sqlite.data" -x
> 
> Exception is thrown here:
> 
>     def convert_date(val):
> E       return datetime.date(*map(int, val.split("-")))
> >       ValueError: invalid literal for int(): 26 12:29:12
> 
> [/.../lib/python2.4/site-packages/pysqlite2/dbapi2.py:63]

   PySQLite2 returns date+time even for date fields. THere is a code in the
test that accomodates to that behaviour:

    if getConnection().dbName == "sqlite":
        from sqlobject.sqlite.sqliteconnection import using_sqlite2
        if using_sqlite2: # PySQLite2 returns full date/time for a date
            dateFormat = "%Y-%m-%d %H:%M:%S"


> Due to this test:
> 
>     def test_mxDateTime():
>         setupClass(DateTime2)
>         _now = now()
> >       dt2 = DateTime2(col1=_now, col2=_now, col3=Time(_now.hour, 
> _now.minute, int(_now.second)))
> 
> [/.../SQLObject/sqlobject/tests/test_datetime.py:60]

   Can you run
py.test -D "sqlite:///tmp/sqlite.data" -x -s >log 2>&1
   and show the log? My log is here:

============================= test process starts =============================
testing-mode: inprocess
executable:   /usr/local/bin/python  (2.4.3-final-0)
using py lib: /usr/local/src/Python/py-dist/py <rev 24040>

test_datetime.py[2] ..

================== tests finished: 2 passed in 0.09 seconds
===================
inserting into sys.path: /usr/local/src/Python/py-dist
 1/QueryOne:  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time1'
 1/QueryR  :  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time1'
 2/QueryOne:  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time1'
 2/QueryR  :  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time1'
 3/QueryOne:  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time1'
 3/QueryR  :  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time1'
 4/Query   :  CREATE TABLE date_time1 (
    id INTEGER PRIMARY KEY,
    col1 TIMESTAMP,
    col2 DATE,
    col3 TIME
)
 4/QueryR  :  CREATE TABLE date_time1 (
    id INTEGER PRIMARY KEY,
    col1 TIMESTAMP,
    col2 DATE,
    col3 TIME
)
 5/QueryIns:  INSERT INTO date_time1 (col2, col3, col1) VALUES
('2006-10-11', '17:44:07', '2006-10-11 17:44:07')
 6/QueryOne:  SELECT col1, col2, col3 FROM date_time1 WHERE id = (1)
 6/QueryR  :  SELECT col1, col2, col3 FROM date_time1 WHERE id = (1)
 7/QueryOne:  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time2'
 7/QueryR  :  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time2'
 8/QueryOne:  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time2'
 8/QueryR  :  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time2'
 9/QueryOne:  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time2'
 9/QueryR  :  SELECT tbl_name FROM sqlite_master WHERE type='table' AND 
tbl_name = 'date_time2'
10/Query   :  CREATE TABLE date_time2 (
    id INTEGER PRIMARY KEY,
    col1 TIMESTAMP,
    col2 DATE,
    col3 TIME
)
10/QueryR  :  CREATE TABLE date_time2 (
    id INTEGER PRIMARY KEY,
    col1 TIMESTAMP,
    col2 DATE,
    col3 TIME
)
11/QueryIns:  INSERT INTO date_time2 (col2, col3, col1) VALUES ('2006-10-11 
17:44:07', '17:44:07', '2006-10-11 17:44:07')
12/QueryOne:  SELECT col1, col2, col3 FROM date_time2 WHERE id = (1)
12/QueryR  :  SELECT col1, col2, col3 FROM date_time2 WHERE id = (1)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to