Configuration File Module

This module is used to deal with anything related to the stestr config file. This includes actually parsing it, and also dealing with interpreting some of it’s contents (like generating a test_processor based on a config file’s contents).

class stestr.config_file.TestrConf(config_file, section='DEFAULT')[source]

Create a TestrConf object to represent a specified config file

This class is used to represent an stestr config file. Or in the case of a tox.ini file the stestr section in the tox.ini file

Parameters:
  • config_file (str) – The path to the config file to use
  • section (str) – The section to use for the stestr config. By default this is DEFATULT.
get_run_command(test_ids=None, regexes=None, test_path=None, top_dir=None, group_regex=None, repo_type='file', repo_url=None, serial=False, worker_path=None, concurrency=0, blacklist_file=None, exclude_list=None, whitelist_file=None, include_list=None, black_regex=None, exclude_regex=None, randomize=False, parallel_class=None)[source]

Get a test_processor.TestProcessorFixture for this config file

Any parameters about running tests will be used for initialize the output fixture so the settings are correct when that fixture is used to run tests. Parameters will take precedence over values in the config file.

Parameters:
  • options – A argparse Namespace object of the cli options that were used in the invocation of the original CLI command that needs a TestProcessorFixture
  • test_ids (list) – an optional list of test_ids to use when running tests
  • regexes (list) – an optional list of regex strings to use for filtering the tests to run. See the test_filters parameter in TestProcessorFixture to see how this is used.
  • test_path (str) – Set the test path to use for unittest discovery. If both this and the corresponding config file option are set, this value will be used.
  • top_dir (str) – The top dir to use for unittest discovery. This takes precedence over the value in the config file. (if one is present in the config file)
  • group_regex (str) – Set a group regex to use for grouping tests together in the stestr scheduler. If both this and the corresponding config file option are set this value will be used.
  • repo_type (str) – This is the type of repository to use. Valid choices are ‘file’ and ‘sql’.
  • repo_url (str) – The url of the repository to use.
  • serial (bool) – If tests are run from the returned fixture, they will be run serially
  • worker_path (str) – Optional path of a manual worker grouping file to use for the run.
  • concurrency (int) – How many processes to use. The default (0) autodetects your CPU count and uses that.
  • blacklist_file (str) – Available now but soon to be replaced by the new option exclude_list below.
  • exclude_list (str) – Path to an exclusion list file, this file contains a separate regex exclude on each newline.
  • whitelist_file (str) – Available now but soon to be replaced by the new option include_list below.
  • include_list (str) – Path to an inclusion list file, this file contains a separate regex on each newline.
  • black_regex (str) – Available now but soon to be replaced by the new option exclude_regex below.
  • exclude_regex (str) – Test rejection regex. If a test cases name matches on re.search() operation, it will be removed from the final test list.
  • randomize (bool) – Randomize the test order after they are partitioned into separate workers
  • parallel_class (bool) – Set the flag to group tests together in the stestr scheduler by class. If both this and the corresponding config file option which includes group-regex are set, this value will be used.
Returns:

a TestProcessorFixture object for the specified config file and any arguments passed into this function

Return type:

test_processor.TestProcessorFixture