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.
-
class
stestr.repository.abstract.
AbstractRepository
[source]¶ The base class for Repository implementations.
There are no interesting attributes or methods as yet.
-
count
()[source]¶ Return the number of test runs this repository has stored.
Return count: The count of test runs stored in the repository.
-
find_metadata
(metadata)[source]¶ 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_failing
()[source]¶ 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.
-
get_test_ids
(run_id)[source]¶ 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.
-
get_test_run
(run_id)[source]¶ Retrieve a TestRun object for run_id.
Parameters: run_id – The test run id to retrieve. Returns: A TestRun object.
-
get_test_times
(test_ids)[source]¶ 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.
-
-
class
stestr.repository.abstract.
AbstractRepositoryFactory
[source]¶ Interface for making or opening repositories.
-
class
stestr.repository.abstract.
AbstractTestRun
[source]¶ 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_id
()[source]¶ 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_metadata
()[source]¶ Get the metadata value for the test run.
Returns: A string of the metadata or None if it doesn’t exist.
-
get_test
()[source]¶ 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).
-