rez.package_test
- class rez.package_test.PackageTestResults[source]
Bases:
objectContains results of running tests with a PackageTestRunner.
Use this class (and pass it to the PackageTestRunner constructor) if you need to gather test run results from separate runners, and display them in a single table.
- property num_failed
Get the number of failed test runs.
- property num_skipped
Get the number of skipped test runs.
- property num_success
Get the number of successful test runs.
- property num_tests
Get the number of tests, regardless of stats.
- valid_statuses = ('success', 'failed', 'skipped')
- class rez.package_test.PackageTestRunner(package_request, use_current_env=False, extra_package_requests=None, package_paths=None, stdout=None, stderr=None, verbose=0, dry_run=False, stop_on_fail=False, cumulative_test_results=None, **context_kwargs)[source]
Bases:
objectObject for running a package’s tests.
This runs the tests listed in the package’s “tests” attribute.
An example tests entry in a package.py might look like this:
- tests = {
“unit”: “python -m unittest -s {root}/tests”, “CI”: {
“command”: “python {root}/ci_tests/main.py”, “requires”: [“maya-2017”], “replace”: True
}
}
By default tests are run in an environment containing the current package.
If a test entry is just a string, then it is treated as the test command. If a dict, the “command” string is the command, and the “requires” list is added to the test env.
Command strings automatically expand references such as ‘{root}’, much as happens in a commands function.
Commands can also be a list - in this case, the test process is launched directly, rather than interpreted via a shell.
- classmethod get_package_test_names(package, run_on=None, ran_once=None)[source]
Get the names of tests in the given package.
- Parameters
run_on (list of str) – If provided, only include tests with run_on tags that overlap with the given list.
ran_once (list of str) – If provided, skip tests that are in this list, and are configured for on_variants=False (ie, just run the test on one variant).
- Returns
Test names.
- Return type
List of str
- get_test_names(run_on=None)[source]
Get the names of tests in this package.
- Parameters
run_on (list of str) – If provided, only include tests with run_on tags that overlap with the given list.
- Returns
Test names.
- Return type
List of str
- property num_failed
Get the number of failed test runs.
- property num_skipped
Get the number of skipped test runs.
- property num_success
Get the number of successful test runs.
- property num_tests
Get the number of tests, regardless of stats.