taucmdr.tests.test_util module

Test functions.

Functions used for unit tests of util.py.

class taucmdr.tests.test_util.CamelCaseTest(methodName='runTest')[source]

Bases: TestCase

Class to test the camelcase function in utils.

_classSetupFailed = False
_class_cleanups = []
test_camelcase()[source]
class taucmdr.tests.test_util.ExtractArchiveTest(methodName='runTest')[source]

Bases: TestCase

Tests for util.extract_archive.

_classSetupFailed = False
_class_cleanups = []
test_extract_archive()[source]

Extracting an archive creates its top-level directory, without deprecation warnings.

test_extract_archive_truncated()[source]

A truncated archive, such as an interrupted download, raises OSError.

An archive with a link that points outside the destination raises OSError and isn’t extracted.

class taucmdr.tests.test_util.HumanSizeTest(methodName='runTest')[source]

Bases: TestCase

Class to test the human_size function in utils.

_classSetupFailed = False
_class_cleanups = []
test_humansize()[source]
class taucmdr.tests.test_util.IsCleanContainerTest(methodName='runTest')[source]

Bases: TestCase

Class to test checking whether containers contain disallowed binary data.

_classSetupFailed = False
_class_cleanups = []
test_false()[source]

Ensure that bytes, bytearray and memoryview objects in keys and values are detected.

test_true()[source]

Ensure that valid containers and other items are not flagged as being bad.

class taucmdr.tests.test_util.IsUrlTest(methodName='runTest')[source]

Bases: TestCase

Class to test the is_url function in utils.

_classSetupFailed = False
_class_cleanups = []
test_false()[source]
test_true()[source]
class taucmdr.tests.test_util.PageOutputTest(methodName='runTest')[source]

Bases: TestCase

Tests for util.page_output.

_classSetupFailed = False
_class_cleanups = []
test_page_output_uses_pager()[source]

The text goes to the pager command in PAGER, which may have arguments and a path with a space.

class taucmdr.tests.test_util.ParseBoolTest(methodName='runTest')[source]

Bases: TestCase

Class to test the parse_bool function in utils.

_classSetupFailed = False
_class_cleanups = []
test_extendfalse()[source]
test_extendtrue()[source]
test_false()[source]
test_true()[source]
class taucmdr.tests.test_util.RmtreeTest(methodName='runTest')[source]

Bases: TestCase

Tests for util.rmtree.

_classSetupFailed = False
_class_cleanups = []
test_onexc()[source]

rmtree passes each failure’s exception to onexc, without deprecation warnings.

class taucmdr.tests.test_util.TemporaryDirectoryTest(methodName='runTest')[source]

Bases: TestCase

Tests for util.mkdtemp, util.cleanup_dtemp and util.tmpfs_prefix.

_classSetupFailed = False
_class_cleanups = []
static _record_mkdtemp(made)[source]
_run_python(code, tmpdir)[source]
test_cleanup_dtemp()[source]

cleanup_dtemp deletes a directory whether or not mkdtemp made it.

test_dtemp_error_warning_names_paths()[source]

The exit hook’s warning gives the full path of each directory it kept.

test_error_dir_copy_failure_at_exit()[source]

A copy of an error directory that fails doesn’t stop the exit hook from deleting the other directories.

test_error_dir_kept_at_exit()[source]

A directory on the error stack is copied to the temporary directory at exit.

test_error_dirs_same_name_kept_at_exit()[source]

Error directories with the same name, including one kept by an earlier run, are both copied.

test_leftover_dtemp_cleaned_at_exit()[source]

A directory from mkdtemp that’s never cleaned up is deleted at exit without a warning.

test_tmpfs_prefix_fallback_kept()[source]

When free space can’t be counted, the first usable candidate is kept and the others are deleted.

test_tmpfs_prefix_rejected_candidate_removed()[source]

A candidate that can’t run executables is deleted.

class taucmdr.tests.test_util.VerifyArchiveTest(methodName='runTest')[source]

Bases: TestCase

Tests for util.verify_archive.

_classSetupFailed = False
_class_cleanups = []
test_verify_archive_truncated()[source]

An archive cut short after its first members is refused, though its top-level directory can be read.

taucmdr.tests.test_util._make_archive(path, links)[source]

Write a gzipped tar file with pkg/file.txt and the symbolic links links ({name: target}) in pkg/.