TestRunner

class astropy.tests.runner.TestRunner(base_path)[source] [edit on github]

Bases: astropy.tests.runner.TestRunnerBase

A test runner for astropy tests

Attributes Summary

keywords

Methods Summary

args(**kwargs) args : str, optional
coverage(**kwargs)
docs_path(**kwargs) docs_path : str, optional
open_files(**kwargs) open_files : bool, optional
package(**kwargs) package : str, optional
packages_path(packages, base_path[, error, …]) Generates the path for multiple packages.
parallel(**kwargs) parallel : int or ‘auto’, optional
pastebin(**kwargs) pastebin : (‘failed’, ‘all’, None), optional
pdb(**kwargs) pdb : bool, optional
pep8(**kwargs) pep8 : bool, optional
plugins(**kwargs) plugins : list, optional
remote_data(**kwargs) remote_data : {‘none’, ‘astropy’, ‘any’}, optional
repeat(**kwargs) repeat : int, optional
run_tests(**kwargs) Run the tests for the package.
skip_docs(**kwargs) skip_docs : bool, optional
test_path(**kwargs) test_path : str, optional
verbose(**kwargs) verbose : bool, optional

Attributes Documentation

keywords = {'args': None, 'coverage': None, 'docs_path': None, 'open_files': None, 'package': None, 'parallel': 0, 'pastebin': None, 'pdb': None, 'pep8': None, 'plugins': ['astropy.tests.plugins.display', 'astropy.tests.plugins.config'], 'remote_data': 'none', 'repeat': None, 'skip_docs': None, 'test_path': None, 'verbose': None}

Methods Documentation

args(**kwargs)[source] [edit on github]
args : str, optional
Additional arguments to be passed to pytest.main in the args keyword argument.
coverage(**kwargs)[source] [edit on github]
docs_path(**kwargs)[source] [edit on github]
docs_path : str, optional
The path to the documentation .rst files.
open_files(**kwargs)[source] [edit on github]
open_files : bool, optional
Fail when any tests leave files open. Off by default, because this adds extra run time to the test suite. Requires the psutil package.
package(**kwargs)[source] [edit on github]
package : str, optional
The name of a specific package to test, e.g. ‘io.fits’ or ‘utils’. Accepts comma separated string to specify multiple packages. If nothing is specified all default tests are run.
packages_path(packages, base_path, error=None, warning=None)[source] [edit on github]

Generates the path for multiple packages.

Parameters:
packages : str

Comma separated string of packages.

base_path : str

Base path to the source code or documentation.

error : str

Error message to be raised as ValueError. Individual package name and path can be accessed by {name} and {path} respectively. No error is raised if None. (Default: None)

warning : str

Warning message to be issued. Individual package name and path can be accessed by {name} and {path} respectively. No warning is issues if None. (Default: None)

Returns:
paths : list of str

List of stings of existing package paths.

parallel(**kwargs)[source] [edit on github]
parallel : int or ‘auto’, optional
When provided, run the tests in parallel on the specified number of CPUs. If parallel is 'auto', it will use the all the cores on the machine. Requires the pytest-xdist plugin.
pastebin(**kwargs)[source] [edit on github]
pastebin : (‘failed’, ‘all’, None), optional
Convenience option for turning on py.test pastebin output. Set to ‘failed’ to upload info for failed tests, or ‘all’ to upload info for all tests.
pdb(**kwargs)[source] [edit on github]
pdb : bool, optional
Turn on PDB post-mortem analysis for failing tests. Same as specifying --pdb in args.
pep8(**kwargs)[source] [edit on github]
pep8 : bool, optional
Turn on PEP8 checking via the pytest-pep8 plugin and disable normal tests. Same as specifying --pep8 -k pep8 in args.
plugins(**kwargs)[source] [edit on github]
plugins : list, optional
Plugins to be passed to pytest.main in the plugins keyword argument.
remote_data(**kwargs)[source] [edit on github]
remote_data : {‘none’, ‘astropy’, ‘any’}, optional
Controls whether to run tests marked with @pytest.mark.remote_data. This can be set to run no tests with remote data (none), only ones that use data from http://data.astropy.org (astropy), or all tests that use remote data (any). The default is none.
repeat(**kwargs)[source] [edit on github]
repeat : int, optional
If set, specifies how many times each test should be run. This is useful for diagnosing sporadic failures.
run_tests(**kwargs)[source] [edit on github]

Run the tests for the package.

This method builds arguments for and then calls pytest.main.

Parameters:
package : str, optional

The name of a specific package to test, e.g. ‘io.fits’ or ‘utils’. Accepts comma separated string to specify multiple packages. If nothing is specified all default tests are run.

args : str, optional

Additional arguments to be passed to pytest.main in the args keyword argument.

docs_path : str, optional

The path to the documentation .rst files.

open_files : bool, optional

Fail when any tests leave files open. Off by default, because this adds extra run time to the test suite. Requires the psutil package.

parallel : int or ‘auto’, optional

When provided, run the tests in parallel on the specified number of CPUs. If parallel is 'auto', it will use the all the cores on the machine. Requires the pytest-xdist plugin.

pastebin : (‘failed’, ‘all’, None), optional

Convenience option for turning on py.test pastebin output. Set to ‘failed’ to upload info for failed tests, or ‘all’ to upload info for all tests.

pdb : bool, optional

Turn on PDB post-mortem analysis for failing tests. Same as specifying --pdb in args.

pep8 : bool, optional

Turn on PEP8 checking via the pytest-pep8 plugin and disable normal tests. Same as specifying --pep8 -k pep8 in args.

plugins : list, optional

Plugins to be passed to pytest.main in the plugins keyword argument.

remote_data : {‘none’, ‘astropy’, ‘any’}, optional

Controls whether to run tests marked with @pytest.mark.remote_data. This can be set to run no tests with remote data (none), only ones that use data from http://data.astropy.org (astropy), or all tests that use remote data (any). The default is none.

repeat : int, optional

If set, specifies how many times each test should be run. This is useful for diagnosing sporadic failures.

skip_docs : bool, optional

When True, skips running the doctests in the .rst files.

test_path : str, optional

Specify location to test by path. May be a single file or directory. Must be specified absolutely or relative to the calling directory.

verbose : bool, optional

Convenience option to turn on verbose output from py.test. Passing True is the same as specifying -v in args.

skip_docs(**kwargs)[source] [edit on github]
skip_docs : bool, optional
When True, skips running the doctests in the .rst files.
test_path(**kwargs)[source] [edit on github]
test_path : str, optional
Specify location to test by path. May be a single file or directory. Must be specified absolutely or relative to the calling directory.
verbose(**kwargs)[source] [edit on github]
verbose : bool, optional
Convenience option to turn on verbose output from py.test. Passing True is the same as specifying -v in args.