Author: phd
Date: Tue Jul 5 09:20:49 2011
New Revision: 4425
Log:
Neil Muller made the test suite runs with both py.test 1.3 and 2.0.
Modified:
SQLObject/trunk/sqlobject/conftest.py
SQLObject/trunk/sqlobject/tests/test_boundattributes.py
SQLObject/trunk/sqlobject/tests/test_paste.py
Modified: SQLObject/trunk/sqlobject/conftest.py
==============================================================================
--- SQLObject/trunk/sqlobject/conftest.py Tue Jul 5 09:19:27 2011 (r4424)
+++ SQLObject/trunk/sqlobject/conftest.py Tue Jul 5 09:20:49 2011 (r4425)
@@ -31,27 +31,32 @@
'mssql': 'mssql://sa:@127.0.0.1/test'
}
-Option = py.test.config.Option
-option = py.test.config.addoptions(
- "SQLObject options",
- Option('-D', '--Database',
+def pytest_addoption(parser):
+ """Add the SQLObject options"""
+ parser.addoption('-D', '--Database',
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()))),
- Option('-S', '--SQL',
+ % (', '.join(connectionShortcuts.keys())))
+ parser.addoption('-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)"),
- Option('-O', '--SQL-output',
+ "SQL is only displayed when a test fails)")
+ parser.addoption('-O', '--SQL-output',
action="store_true", dest="show_sql_output", default=False,
help="Show output from SQL statements (when capturing "
- "stdout the output is only displayed when a test fails)"),
- Option('-E', '--events',
+ "stdout the output is only displayed when a test fails)")
+ parser.addoption('-E', '--events',
action="store_true", dest="debug_events", default=False,
help="Debug events (print information about events as they are "
- "sent)"),
- )
+ "sent)")
+
+option = None
+
+def pytest_configure(config):
+ """Make cmdline arguments available to dbtest"""
+ global option
+ option = config.option
class SQLObjectClass(py.test.collect.Class):
def run(self):
Modified: SQLObject/trunk/sqlobject/tests/test_boundattributes.py
==============================================================================
--- SQLObject/trunk/sqlobject/tests/test_boundattributes.py Tue Jul 5 09:19:27 2011 (r4424)
+++ SQLObject/trunk/sqlobject/tests/test_boundattributes.py Tue Jul 5 09:20:49 2011 (r4425)
@@ -1,7 +1,8 @@
from sqlobject import declarative
from sqlobject import boundattributes
+import py.test
-disabled = True
+pytestmark = py.test.mark.skipif('True')
class TestMe(object):
Modified: SQLObject/trunk/sqlobject/tests/test_paste.py
==============================================================================
--- SQLObject/trunk/sqlobject/tests/test_paste.py Tue Jul 5 09:19:27 2011 (r4424)
+++ SQLObject/trunk/sqlobject/tests/test_paste.py Tue Jul 5 09:20:49 2011 (r4425)
@@ -1,9 +1,11 @@
from dbtest import *
from sqlobject import sqlhub, SQLObject, StringCol
+import py.test
try:
from sqlobject.wsgi_middleware import make_middleware
except ImportError:
- disabled = True
+ pytestmark = py.test.mark.skipif('True')
+
class NameOnly(SQLObject):
name = StringCol()
|