taucmdr.tests package¶
Unit test initializations and utility functions.
- class taucmdr.tests.DarwinTestCase(methodName='runTest')[source]¶
Bases:
TestCaseBase class for tests that run in processes which take this host for a Mac.
Each test gets a new user prefix and an empty project directory.
- _classSetupFailed = False¶
- _class_cleanups = []¶
- python(code)[source]¶
Run Python code as on a Mac and return its output, see
run_python_as_darwin.
- tau(*args)[source]¶
Run
tauas on a Mac, seerun_tau_as_darwin.
- taucmdr.tests.REPO_DIR = '/home/runner/work/taucmdr/taucmdr'¶
Absolute path to the TAU Commander source checkout.
It comes from the environment variable
__TAUCMDR_REPO_DIR__, whichscripts/run_tests.pydefines. Without it, this is the checkout containing this file.- Type:
- taucmdr.tests.RESULTS_DIR = '/home/runner/work/taucmdr/taucmdr/build/test-results'¶
Directory for JUnit XML and timings.
It comes from the environment variable
__TAUCMDR_TEST_RESULTS_DIR__, whichscripts/run_tests.pydefines.- Type:
- taucmdr.tests.TIMING_FILE = '/home/runner/work/taucmdr/taucmdr/build/test-results/test-timings.csv'¶
CSV file to which each test appends its run time.
- Type:
- class taucmdr.tests.TestCase(methodName='runTest')[source]¶
Bases:
TestCaseBase class for unit tests.
Performs tests in a temporary directory and reconfigures
taucmdr.loggerto work withunittest.- _classSetupFailed = False¶
- _class_cleanups = []¶
- assertCleanExit(proc)[source]¶
Check that a process from
run_python_subprocessprinted no Python traceback.TAU Commander’s own report of an unexpected exception goes to stdout, so both streams are checked.
- assertSucceeded(proc)[source]¶
Check that a process from
run_python_subprocessexited with status 0 and no traceback.
- exec_command(cmd, argv)[source]¶
Execute a tau command’s main() routine and return the exit code, stdout, and stderr data.
- reset_project_storage(init_args=None)[source]¶
Delete and recreate project storage.
Effectively the same as:
> rm -rf .tau > tau initialize [init_args]
- Parameters:
init_args (list) – Command line arguments to tau initialize.
- taucmdr.tests.cleanup()[source]¶
Checks that any files or directories created during testing have been removed.
- taucmdr.tests.not_implemented(cls)[source]¶
Decorator for TestCase classes to indicate that the tests have not been written (yet).
- taucmdr.tests.pop_test_workdir()[source]¶
Recursively deletes the most recently created unit test working directory.
Restores the current working directory and
tempfile.tempdirto their values beforepush_test_workdirwas called.
- taucmdr.tests.push_test_workdir()[source]¶
Create a new working directory for a unit test.
Sets the current working directory and
tempfile.tempdirto the newly created test directory.Directories created via this method are tracked. If any of them exist when the program exits then an error message is shown for each.
- taucmdr.tests.run_python_as_darwin(code, cwd, user_prefix, backend=None)[source]¶
Run Python code in a new process that TAU Commander will identify as an Apple silicon Mac.
- Parameters:
- Returns:
The finished process, with text output captured.
- Return type:
- taucmdr.tests.run_python_subprocess(args, env=None, cwd=None, isolated=True)[source]¶
Run this Python interpreter in a new process.
- Parameters:
args (list) – Arguments to the interpreter.
env (dict) – Changes to the environment. A value of None unsets the variable.
cwd (str) – Working directory of the new process.
isolated (bool) – If True, run in isolated mode (
-I), as thetaulauncher does. OtherwisePYTHONPATHis set to this interpreter’ssys.path, so the new process imports the sametaucmdr.
- Returns:
The finished process, with text output captured.
- Return type:
- taucmdr.tests.run_tau_as_darwin(args, cwd, user_prefix, backend=None)[source]¶
Run
tauin a new process that takes this host for an Apple silicon Mac.Building TAU is skipped:
Experiment.configuredoes nothing.
- taucmdr.tests.run_tau_subprocess(args, backend, cwd, user_prefix, system_prefix=None, env=None)[source]¶
Run
tauin a new process with the given storage.- Parameters:
args (list) – Arguments to
tau.backend (str) – Value for
__TAUCMDR_DB_BACKEND__, or None to leave it unset.cwd (str) – Working directory of the new process.
user_prefix (str) – User-level storage prefix.
system_prefix (str) – System-level storage prefix, or None for no system level.
env (dict) – Further changes to the environment, as for
run_python_subprocess.
- Returns:
The finished process, with text output captured.
- Return type:
- taucmdr.tests.skipUnlessHaveCompiler(role)[source]¶
Decorator to skip test functions when no compiler fills the given role.
If no installed compiler can fill this role then skip the test and report “<role> compiler not found”.
- Parameters:
role (_CompilerRole) – A compiler role.
- taucmdr.tests.storage_env(backend, user_prefix, system_prefix=None)[source]¶
Return environment changes that give a new TAU Commander process the given storage.
- Parameters:
- Returns:
Changes for
run_python_subprocess’s env.- Return type:
Submodules¶
- taucmdr.tests.test_cli_reference module
CliReferenceTestCliReferenceTest._classSetupFailedCliReferenceTest._class_cleanupsCliReferenceTest.setUpClass()CliReferenceTest.test_all_commands()CliReferenceTest.test_fixed_width()CliReferenceTest.test_main_page()CliReferenceTest.test_no_defaults()CliReferenceTest.test_no_escape_sequences()CliReferenceTest.test_no_help_page_placeholder()CliReferenceTest.test_page_content()CliReferenceTest.test_write_pages_removes_stale()CliReferenceTest.test_write_pages_unchanged()
_load_extension()
- taucmdr.tests.test_error module
- taucmdr.tests.test_imports module
- taucmdr.tests.test_init module
GlobalsTestGlobalsTest._classSetupFailedGlobalsTest._class_cleanupsGlobalsTest._print_system_prefix()GlobalsTest.test_no_install_tree()GlobalsTest.test_relative_system_prefix()GlobalsTest.test_same_prefix_both_names()GlobalsTest.test_script_name_default()GlobalsTest.test_system_prefix_conflict()GlobalsTest.test_system_prefix_default()GlobalsTest.test_system_prefix_empty()GlobalsTest.test_system_prefix_override()GlobalsTest.test_system_prefix_public_name()
InstalledPackageTestPythonVersionTestVersionTest_import_with_version()
- taucmdr.tests.test_launcher module
LauncherTestLauncherTest._check_children_see_env()LauncherTest._classSetupFailedLauncherTest._class_cleanupsLauncherTest._hostile_env()LauncherTest._read_pager_env()LauncherTest._run()LauncherTest.setUp()LauncherTest.setUpClass()LauncherTest.test_backstop_reexecs_isolated()LauncherTest.test_environment_reaches_children()LauncherTest.test_hostile_environment()LauncherTest.test_missing_python()LauncherTest.test_shebang()LauncherTest.test_symlinked_launcher()
_write()
- taucmdr.tests.test_logger module
- taucmdr.tests.test_no_system_level module
NoSystemLevelTestNoSystemLevelTest._classSetupFailedNoSystemLevelTest._class_cleanupsNoSystemLevelTest._tau()NoSystemLevelTest.setUpClass()NoSystemLevelTest.test_packages_in_user_storage()NoSystemLevelTest.test_project_after_removal()NoSystemLevelTest.test_system_commands_refused()NoSystemLevelTest.test_trial_without_system_level()
- taucmdr.tests.test_progress module
ProgressIndicatorTestProgressIndicatorTest._classSetupFailedProgressIndicatorTest._class_cleanupsProgressIndicatorTest._draw()ProgressIndicatorTest._output()ProgressIndicatorTest.test_disabled_draws_nothing()ProgressIndicatorTest.test_disabled_keeps_no_phases()ProgressIndicatorTest.test_full_without_terminal()ProgressIndicatorTest.test_line_width()ProgressIndicatorTest.test_no_terminal_defaults_to_disabled()ProgressIndicatorTest.test_terminal_defaults_to_full()
- taucmdr.tests.test_pylint module
- taucmdr.tests.test_requirements module
- taucmdr.tests.test_run_tests module
RunTestsTestRunTestsTest._classSetupFailedRunTestsTest._class_cleanupsRunTestsTest._make_modules()RunTestsTest._probe_system_prefix()RunTestsTest._run()RunTestsTest.test_deprecation_warnings()RunTestsTest.test_import_error_traceback()RunTestsTest.test_list_unloadable_name()RunTestsTest.test_name_without_tests()RunTestsTest.test_namespace_package()RunTestsTest.test_nested_run_results_dir()RunTestsTest.test_no_implicit_tempdir_cleanup()RunTestsTest.test_package_name()RunTestsTest.test_prints_tested_package()RunTestsTest.test_repo_dir()RunTestsTest.test_results_dir_replaced()RunTestsTest.test_sandbox_cleanup_failure()RunTestsTest.test_script_name()RunTestsTest.test_system_prefix_absolute()RunTestsTest.test_system_prefix_created()RunTestsTest.test_system_prefix_default()RunTestsTest.test_system_prefix_public_name()
- taucmdr.tests.test_util module
CamelCaseTestExtractArchiveTestHumanSizeTestIsCleanContainerTestIsUrlTestPageOutputTestParseBoolTestRmtreeTestTemporaryDirectoryTestTemporaryDirectoryTest._classSetupFailedTemporaryDirectoryTest._class_cleanupsTemporaryDirectoryTest._record_mkdtemp()TemporaryDirectoryTest._run_python()TemporaryDirectoryTest.test_cleanup_dtemp()TemporaryDirectoryTest.test_dtemp_error_warning_names_paths()TemporaryDirectoryTest.test_error_dir_copy_failure_at_exit()TemporaryDirectoryTest.test_error_dir_kept_at_exit()TemporaryDirectoryTest.test_error_dirs_same_name_kept_at_exit()TemporaryDirectoryTest.test_leftover_dtemp_cleaned_at_exit()TemporaryDirectoryTest.test_tmpfs_prefix_fallback_kept()TemporaryDirectoryTest.test_tmpfs_prefix_rejected_candidate_removed()
VerifyArchiveTest_make_archive()