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.
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 setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
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.
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
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
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_aaa_shell_presence()[source]
Ensure specific shell types are present as loaded plugins.
The env var _REZ_ENSURE_TEST_SHELLS should be set by a CI system (such as github actions) to make sure the shells we expect to be installed, are installed, and are getting tested.
Note ‘aaa’ forces unittest to run this test first.
- test_alias_command(shell)[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(shell)[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_rex_code(shell)[source]
Test that Rex code run in the shell creates the environment variable values that we expect.
- test_rex_code_alias(shell)[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.
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
1.1.1.4.9. rez.tests.util module
- class rez.tests.util.TestBase(*nargs, **kwargs)[source]
Bases:
unittest.case.TestCaseUnit test base class.
- 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.
- classmethod setUpClass()[source]
Hook method for setting up class fixture before running tests in the class.
- 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_settingsdict
the updated settings to override the config with
- overridebool
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(exclude=None)[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()[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()[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.