/usr/lib/python2.7/dist-packages/sqlobject/conftest.py is in python-sqlobject 2.1.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | """
This module is used by py.test to configure testing for this
application.
"""
# Override some options (doesn't override command line):
verbose = 0
exitfirst = True
import py
import os
import sqlobject
connectionShortcuts = {
'mysql': 'mysql://test@localhost/test',
'dbm': 'dbm:///data',
'postgres': 'postgres:///test',
'postgresql': 'postgres:///test',
'rdbhost': 'rdhbost://role:authcode@www.rdbhost.com/',
'pygresql': 'pygresql://localhost/test',
'sqlite': 'sqlite:/:memory:',
'sybase': 'sybase://test:test123@sybase/test?autoCommit=0',
'firebird': 'firebird://sysdba:masterkey@localhost/var/lib/firebird/data/test.gdb',
'mssql': 'mssql://sa:@127.0.0.1/test'
}
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())))
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)")
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)")
parser.addoption('-E', '--events',
action="store_true", dest="debug_events", default=False,
help="Debug events (print information about events as they are "
"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):
if (isinstance(self.obj, type)
and issubclass(self.obj, sqlobject.SQLObject)):
return []
return super(SQLObjectClass, self).run()
Class = SQLObjectClass
def setup_tests():
if option.debug_events:
from sqlobject import events
events.debug_events()
|