# Loader: Test discovery

Discovery-based test loader.

This plugin implements nose2’s automatic test module discovery. It looks for test modules in packages and directories whose names start with `test`, then fires the `loadTestsFromModule()` hook for each one to allow other plugins to load the actual tests.

It also fires `handleFile()` for every file that it sees, and `matchPath()` for every Python module, to allow other plugins to load tests from other kinds of files and to influence which modules are examined for tests.

## Configuration [discovery]

always-on
  Default:

    True

  Type:

    boolean

### Sample configuration

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

    [discovery]
    always-on = True

## Plugin class reference: DiscoveryLoader

class nose2.plugins.loader.discovery.DiscoveryLoader(*args, **kwargs)

  Loader plugin that can discover tests

  loadTestsFromName(event)

    Load tests from module named by event.name

  loadTestsFromNames(event)

    Discover tests if no test names specified