On a clean checkout of web.py and a fairly standard Python 2.7 install I see the following behavior when I try to run tests (tracebacks truncated for space):
$ python test/alltests.py Unable to import psycopg2 (ignoring PostgresTest) Unable to import pysqlite2.dbapi2 (ignoring SqliteTest_pysqlite2) No module named MySQLdb (ignoring MySQLTest) Unable to import psycopg (ignoring PostgresTest_psycopg) Unable to import pgdb (ignoring PostgresTest_pgdb) No module named DBUtils(ignoring testPooling) .................................................................................................................................. http://0.0.0.0:8080/ ...EEEE.... ====================================================================== ERROR: testBadSessionId (session.DBSessionTest) ---------------------------------------------------------------------- .... ImportError: Unable to import psycopg2 or psycopg or pgdb class SessionTest(webtest.TestCase): ====================================================================== ERROR: testParallelSessions (session.DBSessionTest) ---------------------------------------------------------------------- .... ImportError: Unable to import psycopg2 or psycopg or pgdb ====================================================================== ERROR: testRedirect (session.DBSessionTest) ---------------------------------------------------------------------- .... ImportError: Unable to import psycopg2 or psycopg or pgdb ====================================================================== ERROR: testSession (session.DBSessionTest) ---------------------------------------------------------------------- .... ImportError: Unable to import psycopg2 or psycopg or pgdb ---------------------------------------------------------------------- Ran 141 tests in 4.908s FAILED (errors=4) These errors, in session.py, occur even though we skip the postgres tests in db.py succesfully, because the same check isn't made in the session test. Since session behavior is (theoretically) db agnostic, it ought to be ok to switch the test to use SQLite, which will enable more people (Python 2.5 and up) to run the tests successfully without additional system requirements. With this patch, all tests pass. diff --git a/test/session.py b/test/session.py --- a/test/session.py +++ b/test/session.py @@ -70,12 +70,12 @@ class DBSessionTest(SessionTest): """Session test with db store.""" def make_session(self, app): - db = webtest.setup_database("postgres") + db = webtest.setup_database("sqlite","sqlite3") #db.printing = True db.query("" + "CREATE TABLE session (" + " session_id char(128) unique not null," - + " atime timestamp default (current_timestamp at time zone 'utc')," + + " atime timestamp default (datetime('now','utc'))," + " data text)" ) store = web.session.DBStore(db, 'session') @@ -83,7 +83,7 @@ def tearDown(self): # there might be some error with the current connection, delete from a new connection - self.db = webtest.setup_database("postgres") + self.db = webtest.setup_database("sqlite","sqlite3") self.db.query('DROP TABLE session') if __name__ == "__main__": Michael Michael Diamond [email protected] www.DigitalGemstones.com -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
