stestr run Command

Run a projects tests and load them into stestr.

class stestr.commands.run.Run(app, app_args, cmd_name=None)[source]
get_description()[source]

Return the command description.

The default is to use the first line of the class’ docstring as the description. Set the _description class attribute to a one-line description of a command to use a different value. This is useful for enabling translations, for example, with _description set to a string wrapped with a gettext translation marker.

get_parser(prog_name)[source]

Return an argparse.ArgumentParser.

take_action(parsed_args)[source]

Override to do something useful.

The returned value will be returned by the program.

stestr.commands.run.run_command(config='.stestr.conf', repo_type='file', repo_url=None, test_path=None, top_dir=None, group_regex=None, failing=False, serial=False, concurrency=0, load_list=None, partial=False, subunit_out=False, until_failure=False, analyze_isolation=False, isolated=False, worker_path=None, blacklist_file=None, whitelist_file=None, black_regex=None, no_discover=False, random=False, combine=False, filters=None, pretty_out=True, color=False, stdout=<open file '<stdout>', mode 'w'>, abbreviate=False, suppress_attachments=False)[source]

Function to execute the run command

This function implements the run command. It will run the tests specified in the parameters based on the provided config file and/or arguments specified in the way specified by the arguments. The results will be printed to STDOUT and loaded into the repository.

Parameters:
  • config (str) – The path to the stestr config file. Must be a string.
  • 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.
  • 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.
  • failing (bool) – Run only tests known to be failing.
  • serial (bool) – Run tests serially
  • concurrency (int) – “How many processes to use. The default (0) autodetects your CPU count and uses that.
  • load_list (str) – The path to a list of test_ids. If specified only tests listed in the named file will be run.
  • partial (bool) – DEPRECATED: Only some tests will be run. Implied by –failing. This flag is deprecated because and doesn’t do anything it will be removed in a future release.
  • subunit_out (bool) – Display results in subunit format.
  • until_failure (bool) – Repeat the run again and again until failure occurs.
  • analyze_isolation (bool) – Search the last test run for 2-test test isolation interactions.
  • isolated (bool) – Run each test id in a separate test runner.
  • worker_path (str) – Optional path of a manual worker grouping file to use for the run.
  • blacklist_file (str) – Path to a blacklist file, this file contains a separate regex exclude on each newline.
  • whitelist_file (str) – Path to a whitelist file, this file contains a separate regex on each newline.
  • black_regex (str) – Test rejection regex. If a test cases name matches on re.search() operation, it will be removed from the final test list.
  • no_discover (str) – Takes in a single test_id to bypasses test discover and just execute the test specified. A file name may be used in place of a test name.
  • random (bool) – Randomize the test order after they are partitioned into separate workers
  • combine (bool) – Combine the results from the test run with the last run in the repository
  • filters (list) – A list of string regex filters to initially apply on the test list. Tests that match any of the regexes will be used. (assuming any other filtering specified also uses it)
  • pretty_out (bool) – Use the subunit-trace output filter
  • color (bool) – Enable colorized output in subunit-trace
  • stdout (file) – The file object to write all output to. By default this is sys.stdout
  • abbreviate (bool) – Use abbreviated output if set true
  • suppress_attachments (bool) – When set true attachments subunit_trace will not print attachments on successful test execution.
Return return_code:
 

The exit code for the command. 0 for success and > 0 for failures.

Return type:

int