asv.benchmarks

Classes

Benchmarks

Manages and runs the set of benchmarks in the project.

Module Contents

class asv.benchmarks.Benchmarks(conf, benchmarks, regex=None)[source]

Manages and runs the set of benchmarks in the project.

api_version = 2[source]
_conf[source]
_benchmark_dir[source]
_all_benchmarks[source]
_benchmark_selection[source]
property benchmark_selection[source]

Active sets of parameterized benchmarks.

property benchmark_dir[source]

Benchmark directory.

filter_out(skip)[source]

Return a new Benchmarks object, with some benchmarks filtered out.

classmethod discover(conf, repo, environments, commit_hash, regex=None, check=False)[source]

Discover benchmarks in the given benchmark_dir.

Parameters

confConfig object

The project’s configuration

repoRepo object

The project’s repository

environmentslist of Environment

List of environments available for benchmark discovery.

commit_hashlist of str

Commit hashes to use for benchmark discovery.

regexstr or list of str, optional

regex is a list of regular expressions matching the benchmarks to run. If none are provided, all benchmarks are run.

checkbool

Run additional checks after discovery.

classmethod _disc_benchmarks(conf, repo, environments, commit_hashes, check)[source]

Discover all benchmarks in a directory tree.

classmethod check_tree(root, require_init_py=True)[source]

Check the benchmark tree for files with the same name as directories.

Also, ensure that the top-level directory has an __init__.py file.

Raises

UserError

A .py file and directory with the same name (excluding the extension) were found.

classmethod get_benchmark_file_path(results_dir)[source]

Get the path to the benchmarks.json file in the results dir.

save()[source]

Save the benchmarks.json file, which is a cached set of the metadata about the discovered benchmarks, in the results dir.

classmethod load(conf, regex=None)[source]

Load the benchmark descriptions from the benchmarks.json file. If the file is not found, one of the given environments will be used to discover benchmarks.

Parameters

confConfig object

The project’s configuration

regexstr or list of str, optional

regex is a list of regular expressions matching the benchmarks to load. See __init__ docstring.

Returns

benchmarks : Benchmarks object