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 NoseDBReporterBase

  • implement the configure(), startTest(), report() and construct_schema() methods. (For an example see the MySQL implementation in NoseMySQLReporter)

  • add your new class to the connectors in plugin in 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

Inheritance diagram of nosedbreport.plugin, nosedbreport.base, nosedbreport.mysql, nosedbreport.sqlite

Source Documentation

class nosedbreport.plugin.NoseDBReporter[source]

The main plugin that is loaded by nose.plugin.PluginManager

configure(options, conf)[source]

Configure plugin. Plugin is disabled by default.

connectors = {'sqlite': <class 'nosedbreport.sqlite.NoseSQLiteReporter'>, 'mysql': <class 'nosedbreport.mysql.NoseMySQLReporter'>}

list of db connectors available for use when specifying db_type.

options(parser, env)[source]

Register commandline options

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 test to 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 test to ‘fail’, collects the trace and time taken to execute.

addSuccess(test, capt=None)[source]

sets the status of the test to ‘pass’, and sets the time taken to execute.

get_full_doc(test)[source]

via various nasty inspection methods, return the full docstring of the test being executed now.

startTest(test)[source]

collect information about a test before 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, testcaseexecution and testsuiteexecution

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.

report(stream)[source]

After successful completion of a nose run, perform the final reporting of the test results to the MySQL database.

startTest(test)[source]

record initiation of a test case. Update the last start time of the test suite & test case.

class nosedbreport.sqlite.NoseSQLiteReporter[source]

SQLLite Connector. Reports the results of each test run into the tables testcase, testsuite,``testcaseexecution`` and testsuiteexecution

configure(options, conf)[source]

sets up the sqlite database connection

construct_schema()[source]

called when the –dbreport_create_schema command option is passed to the plugin to create the sqlite table schema.

report(stream)[source]

After successful completion of a nose run, perform the final reporting of the test results to the sqlite database.

startTest(test)[source]

record initiation of a test case (test). Update the last start time of the test suite & test case.