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

  • 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 DEFAULT.
get_run_command(test_ids=None, regexes=None, test_path=None, top_dir=None, group_regex=None, repo_url=None, serial=False, worker_path=None, concurrency=0, exclude_list=None, include_list=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.

  • 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_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.
  • exclude_list (str) – Path to an exclusion list file, this file contains a separate regex exclude on each newline.
  • include_list (str) – Path to an inclusion list file, this file contains a separate regex on each newline.
  • exclude_regex (str) – Test rejection regex. If a test cases name matches on 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.

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

Return type:


classmethod load_from_file(config)[source]

Load user-specified values from the various config files.

ConfigParser (.ini) and TOML are supported. If a config file is specified, it is used, and fails on errors. If no config file is specified, the order of precedence is as follows: - .stestr.conf - pyproject.toml with a valid [tool.stestr] section - tox.ini with a valid [stestr] section

Parameters:config (str) – The pathname of the config file to use