Collecting tests without running them

This plugin implements startTestRun(), setting a test executor (event.executeTests) that just collects tests without executing them. To do so it calls result.startTest, result.addSuccess and result.stopTest for each test, without calling the test itself.

Enable this Plugin

This plugin is built-in, but not loaded by default.

Even if you specify always-on = True in the configuration, it will not run unless you also enable it. You can do so by putting the following in a unittest.cfg or nose2.cfg file

[unittest]
plugins = nose2.plugins.collect

The plugins parameter may contain a list of plugin names, including nose2.plugins.collect

Configuration [collect-only]

always-on
Default:False
Type:boolean

Sample configuration

The default configuration is equivalent to including the following in a unittest.cfg file.

[collect-only]
always-on = False

Command-line options

--collect-only DEFAULT

Collect and output test names; do not run any tests

Plugin class reference: CollectOnly

class nose2.plugins.collect.CollectOnly[source]

Collect but don’t run tests

collectTests(suite, result)[source]

Collect tests, but don’t run them

startTestRun(event)[source]

Replace event.executeTests