Author: ianb
Date: 2005-05-10 17:20:20 +0000 (Tue, 10 May 2005)
New Revision: 781
Modified:
trunk/SQLObject/sqlobject/conftest.py
trunk/SQLObject/sqlobject/tests/dbtest.py
Log:
Added test option to show SQL
Modified: trunk/SQLObject/sqlobject/conftest.py
===================================================================
--- trunk/SQLObject/sqlobject/conftest.py 2005-05-10 17:10:27 UTC (rev 780)
+++ trunk/SQLObject/sqlobject/conftest.py 2005-05-10 17:20:20 UTC (rev 781)
@@ -29,7 +29,11 @@
action="store", dest="Database", default='sqlite',
help="The database to run the tests under (default sqlite). "
"Can also use an alias from: %s"
- % (', '.join(connectionShortcuts.keys()))))
+ % (', '.join(connectionShortcuts.keys()))),
+ Option('-S', '--SQL',
+ action="store_true", dest="show_sql", default=False,
+ help="Show SQL from statements (when capturing stdout the "
+ "SQL is only displayed when a test fails)"))
class SQLObjectClass(py.test.collect.Class):
def run(self):
Modified: trunk/SQLObject/sqlobject/tests/dbtest.py
===================================================================
--- trunk/SQLObject/sqlobject/tests/dbtest.py 2005-05-10 17:10:27 UTC (rev 780)
+++ trunk/SQLObject/sqlobject/tests/dbtest.py 2005-05-10 17:20:20 UTC (rev 781)
@@ -80,7 +80,10 @@
name = conftest.option.Database
if conftest.connectionShortcuts.has_key(name):
name = conftest.connectionShortcuts[name]
- return sqlobject.connectionForURI(name, **kw)
+ conn = sqlobject.connectionForURI(name, **kw)
+ if conftest.option.show_sql:
+ conn.debug = True
+ return conn
connection = getConnection()
|