Development¶
Contributing¶
The source is maintained in a bitbucket repository. Feel free to fork it to modify/extend the plugin. Currently, the plugin is only backed by a MySQL & SQLite connector, but it can be easily extended to support other databases.
To add a new database connector, you will need to:
add a new class that extends
NoseDBReporterBaseimplement the
configure(),startTest(),report()andconstruct_schema()methods. (For an example see the MySQL implementation inNoseMySQLReporter)add your new class to the
connectorsinpluginin the following way:import newconnector connectors = { "newconnector" : newconnector.NoseNewConnectorReporter, "mysql" : mysql.NoseMySQLReporter }this will make the newconnector available with the command line option –dbreport_dbtype=newconnector
Class Structure¶
Source Documentation¶
-
class
nosedbreport.plugin.NoseDBReporter[source]¶ The main plugin that is loaded by
nose.plugin.PluginManager-
connectors= {'sqlite': <class 'nosedbreport.sqlite.NoseSQLiteReporter'>, 'mysql': <class 'nosedbreport.mysql.NoseMySQLReporter'>}¶ list of db connectors available for use when specifying db_type.
-
-
class
nosedbreport.base.NoseDBReporterBase[source]¶ Base class for Nose plugins that stash test results into a database.
-
addError(test, err, capt=None)[source]¶ sets the status of the
testto either ‘skipped’ or ‘error’, collects the trace and time taken to execute.
-
addFailure(test, err, capt=None, tb_info=None)[source]¶ sets the status of the
testto ‘fail’, collects the trace and time taken to execute.
-
addSuccess(test, capt=None)[source]¶ sets the status of the
testto ‘pass’, and sets the time taken to execute.
-
get_full_doc(test)[source]¶ via various nasty inspection methods, return the full docstring of the
testbeing executed now.
-
startTest(test)[source]¶ collect information about a
testbefore it begins, and initialize a timer to record time taken.
-
test_case_results= None¶ dictionary to keep track of individual test case executions, including status, time taken and tracebacks.
-
test_suites= None¶ dictionary to keep track of the overall suite results
-
-
class
nosedbreport.mysql.NoseMySQLReporter[source]¶ MySQL Connector. Reports the results of each test run into the tables
testcase,testsuite,testcaseexecutionandtestsuiteexecution-
configure(options, conf)[source]¶ sets up the MySQL database connection based on the options provided on the command line.
-
construct_schema()[source]¶ called when the –dbreport_create_schema command option is passed to the plugin to create the mysql table schema.
-
-
class
nosedbreport.sqlite.NoseSQLiteReporter[source]¶ SQLLite Connector. Reports the results of each test run into the tables
testcase,testsuite,``testcaseexecution`` andtestsuiteexecution-
construct_schema()[source]¶ called when the –dbreport_create_schema command option is passed to the plugin to create the sqlite table schema.
-