stestr run Command¶
Run a projects tests and load them into stestr.
Run(app, app_args, cmd_name=None)[source]¶
Run the tests for a project and store them into the repository.
Without –subunit, the process exit code will be non-zero if the test run was not successful. However, with –subunit, the process exit code is non-zero only if the subunit stream could not be generated successfully. The test results and run status are included in the subunit stream, so the stream should be used to determining the result of the run instead of the exit code when using the –subunit flag.
run_command(config='.stestr.conf', repo_url=None, test_path=None, top_dir=None, group_regex=None, failing=False, serial=False, concurrency=0, load_list=None, subunit_out=False, until_failure=False, analyze_isolation=False, isolated=False, worker_path=None, exclude_list=None, include_list=None, exclude_regex=None, no_discover=False, random=False, combine=False, filters=None, pretty_out=True, color=False, stdout=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, abbreviate=False, suppress_attachments=False, all_attachments=False, show_binary_attachments=True, pdb=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.
- config (str) – The path to the stestr config file. Must be a string.
- 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.
- 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.
- exclude_list (str) – Path to an exclusion list file, this file contains a separate regex exclude on each newline.
- include_list (str) – Path to a 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 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.
- all_attachments (bool) – When set true subunit_trace will print all text attachments on successful test execution.
- show_binary_attachments (bool) – When set to true, subunit_trace will print binary attachments in addition to text attachments.
- pdb (str) – Takes in a single test_id to bypasses test discover and just execute the test specified without launching any additional processes. A file name may be used in place of a test name.
The exit code for the command. 0 for success and > 0 for failures.