1.1.1.4. rez.tests package

1.1.1.4.1. Submodules

1.1.1.4.2. rez.tests.test_build module

test the build system

class rez.tests.test_build.TestBuild(*nargs, **kwargs)[source]

Bases: rez.tests.util.TestBase, rez.tests.util.TempdirMixin

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_build_cmake(*args, **kwargs)[source]

Test a cmake-based package.

test_build_custom(*args, **kwargs)[source]

Test a make-based package that uses the custom_build attribute.

test_build_whack(*args, **kwargs)[source]

Test that a broken build fails correctly.

test_builds(*args, **kwargs)[source]

Test an interdependent set of builds.

test_builds_anti(*args, **kwargs)[source]

Test we can build packages that contain anti packages

1.1.1.4.3. rez.tests.test_commands module

test package commands

class rez.tests.test_commands.TestCommands(fn)[source]

Bases: rez.tests.util.TestBase

classmethod get_packages_path()[source]
classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_2()[source]

Resolve a package with a dependency, see that their commands are concatenated as expected.

test_new_yaml()[source]

Resolve a yaml-based package with new rex commands.

test_old_yaml()[source]

Resolve a yaml-based package with old-style bash commands.

test_py()[source]

Resolve a new py-based package with rex commands.

1.1.1.4.4. rez.tests.test_context module

test resolved contexts

class rez.tests.test_context.TestContext(*nargs, **kwargs)[source]

Bases: rez.tests.util.TestBase, rez.tests.util.TempdirMixin

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_apply()[source]

Test apply() function.

test_bundled()[source]

Test that a bundled context behaves identically.

test_create_context()[source]

Test creation of context.

test_execute_command()[source]

Test command execution in context.

test_execute_command_environ()[source]

Test that execute_command properly sets environ dict.

test_retarget()[source]

Test that a retargeted context behaves identically.

test_serialize()[source]

Test context serialization.

1.1.1.4.5. rez.tests.test_formatter module

test rex string formatting

class rez.tests.test_formatter.TestFormatter(*nargs, **kwargs)[source]

Bases: rez.tests.util.TestBase

assert_formatter_equal(format, expected, *args, **kwargs)[source]
assert_formatter_raises(format, error, *args, **kwargs)[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_formatter_recurse()[source]
test_formatter_rex()[source]
test_formatter_stdlib()[source]

string.Formatter.format tests from the Python standard library used to ensure we haven’t broken functionality preset in the standard implementation of the Formatter object.

1.1.1.4.6. rez.tests.test_rex module

test the rex command generator API

class rez.tests.test_rex.TestRex(*nargs, **kwargs)[source]

Bases: rez.tests.util.TestBase

test_1()[source]

Test simple use of every available action.

test_2()[source]

Test simple setenvs and assignments.

test_3()[source]

Test appending/prepending.

test_4()[source]

Test control flow using internally-set env vars.

test_5()[source]

Test control flow using externally-set env vars.

test_6()[source]

Test variable expansion.

test_7()[source]

Test exceptions.

test_8()[source]

Custom environment variable separators.

test_9()[source]

Test literal and expandable strings.

test_intersects_ephemerals()[source]

Test intersects with ephemerals object

test_intersects_request()[source]

Test intersects with request object

test_intersects_resolve()[source]

Test intersects with resolve object

test_old_style_commands()[source]

Convert old style commands to rex

test_version_binding()[source]

Test the Rex binding of the Version class.

1.1.1.4.7. rez.tests.test_shells module

test shell invocation

class rez.tests.test_shells.TestShells(*nargs, **kwargs)[source]

Bases: rez.tests.util.TestBase, rez.tests.util.TempdirMixin

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_alias_command(*args, **kwargs)[source]

Testing alias can be passed in as command

This is important for Windows CMD shell because the doskey.exe isn’t executed yet when the alias is being passed.

test_alias_command_with_args(*args, **kwargs)[source]

Testing alias can be passed in as command with args

This is important for Windows CMD shell because the doskey.exe isn’t executed yet when the alias is being passed.

test_command(*args, **kwargs)[source]
test_command_returncode(*args, **kwargs)[source]
test_create_executable_script()[source]
test_no_output(*args, **kwargs)[source]
test_norc(*args, **kwargs)[source]
test_rcfile(*args, **kwargs)[source]
test_rex_code(*args, **kwargs)[source]

Test that Rex code run in the shell creates the environment variable values that we expect.

test_rex_code_alias(*args, **kwargs)[source]

Ensure PATH changes do not influence the alias command.

This is important for Windows because the doskey.exe might not be on the PATH anymore at the time it’s executed. That’s why we figure out the absolute path to doskey.exe before we modify PATH and continue to use the absolute path after the modifications.

test_rez_command(*args, **kwargs)[source]
test_rez_env_output(*args, **kwargs)[source]
test_stdin(*args, **kwargs)[source]

1.1.1.4.8. rez.tests.test_solver module

test dependency resolving algorithm

class rez.tests.test_solver.TestSolver(*nargs, **kwargs)[source]

Bases: rez.tests.util.TestBase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_01()[source]

Extremely basic solves involving a single package.

test_02()[source]

Basic solves involving a single package.

test_03()[source]

Failures in the initial request.

test_04()[source]

Basic failures.

test_05()[source]

More complex failures.

test_06()[source]

Basic solves involving multiple packages.

test_07()[source]

More complex solves.

test_08()[source]

Cyclic failures.

test_09_version_priority_mode()[source]
test_10_intersection_priority_mode()[source]
test_11_variant_splitting()[source]

1.1.1.4.9. rez.tests.util module

class rez.tests.util.TempdirMixin[source]

Bases: object

Mixin that adds tmpdir create/delete.

classmethod setUpClass()[source]
classmethod tearDownClass()[source]
class rez.tests.util.TestBase(*nargs, **kwargs)[source]

Bases: unittest.case.TestCase

Unit test base class.

classmethod data_path(*dirs)[source]

Get path to test data.

get_settings_env()[source]

Get an environ dict that applies the current settings.

This is required for cases where a subproc has to pick up the same config settings that the test case has set.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

setup_config()[source]
setup_once()[source]
tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

teardown_config()[source]
update_settings(new_settings, override=False)[source]

Can be called within test methods to modify settings on a per-test basis (as opposed cls.settings, which modifies it for all tests on the class)

Note that multiple calls will not “accumulate” updates, but will instead patch the class’s settings with the new_settings each time.

new_settings : dict
the updated settings to override the config with
override : bool
normally, the resulting config will be the result of merging the base cls.settings with the new_settings - ie, like doing cls.settings.update(new_settings). If this is True, however, then the cls.settings will be ignored entirely, and the new_settings will be the only configuration settings applied
rez.tests.util.find_file_in_path(to_find, path_str, pathsep=None, reverse=True)[source]

Attempts to find the given relative path to_find in the given path

rez.tests.util.install_dependent()[source]

Function decorator that skips tests if not run via ‘rez-selftest’ tool, from a production install

rez.tests.util.per_available_shell()[source]

Function decorator that runs the function over all available shell types.

rez.tests.util.program_dependent(program_name, *program_names)[source]

Function decorator that skips the function if not all given programs are visible.

rez.tests.util.restore_os_environ(*args, **kwds)[source]

Encapsulate changes to os.environ and return to the original state.

This context manager lets you wrap modifications of os.environ and not worry about reverting back to the original.

Examples

>>> key = 'ARBITRARY_KEY'
>>> value = 'arbitrary_value'
>>> with os_environ():
>>>     os.environ[key] = value
>>>     assert key in os.environ
True
>>> assert key in os.environ
False
Yields:dict – The original os.environ.
rez.tests.util.restore_sys_path(*args, **kwds)[source]

Encapsulate changes to sys.path and return to the original state.

This context manager lets you wrap modifications of sys.path and not worry about reverting back to the original.

Examples

>>> path = '/arbitrary/path'
>>> with sys_path():
>>>     sys.path.insert(0, '/arbitrary/path')
>>>     assert path in sys.path
True
>>> assert path in sys.path
False
Yields:list – The original sys.path.

1.1.1.4.10. Module contents