Abstract Repository Class¶
Storage of test results.
A Repository provides storage and indexing of results.
The AbstractRepository class defines the contract to which any Repository implementation must adhere.
The stestr.repository.file module (see: File Repository Type is the usual repository that will be used. The stestr.repository.memory module (see: Memory Repository Type) provides a memory only repository useful for internal testing.
Repositories are identified by their URL, and new ones are made by calling the initialize function in the appropriate repository module.
The base class for Repository implementations.
There are no interesting attributes or methods as yet.
Return the number of test runs this repository has stored.
Return count: The count of test runs stored in the repository.
Return the list of run_ids for a given metadata string.
Param: metadata: the metadata string to search for. Returns: a list of any test_ids that have that metadata value.
Get a TestRun that contains all of and only current failing tests.
Returns: a TestRun.
get_inserter(partial=False, run_id=None, metadata=None)[source]¶
Get an inserter that will insert a test run into the repository.
Repository implementations should implement _get_inserter.
get_inserter() does not add timing data to streams: it should be provided by the caller of get_inserter (e.g. commands.load).
Parameters: partial – DEPREACTED: If True, the stream being inserted only executed some tests rather than all the projects tests. This option is deprecated and no longer does anything. It will be removed in the future. Return an inserter: Inserters meet the extended TestResult protocol that testtools 0.9.2 and above offer. The startTestRun and stopTestRun methods in particular must be called.
Return the test ids from the specified run.
Parameters: run_id – the id of the test run to query. Returns: a list of test ids for the tests that were part of the specified test run.
Retrieve a TestRun object for run_id.
Parameters: run_id – The test run id to retrieve. Returns: A TestRun object.
Retrieve estimated times for the tests test_ids.
Parameters: test_ids – The test ids to query for timing data. Returns: A dict with two keys: ‘known’ and ‘unknown’. The unknown key contains a set with the test ids that did run. The known key contains a dict mapping test ids to time in seconds.
Interface for making or opening repositories.
Create a repository at URL.
Call on the class of the repository you wish to create.
A test run that has been stored in a repository.
Should implement the StreamResult protocol as well as the stestr specific methods documented here.
Get the id of the test run.
Sometimes test runs will not have an id, e.g. test runs for ‘failing’. In that case, this should return None.
Get the metadata value for the test run.
Returns: A string of the metadata or None if it doesn’t exist.
Get a testtools.TestCase-like object that can be run.
Returns: A TestCase like object which can be run to get the individual tests reported to a testtools.StreamResult/TestResult. (Clients of repository should provide an ExtendedToStreamDecorator decorator to permit either API to be used).