mozpack.test package

Submodules

mozpack.test.test_archive module

class mozpack.test.test_archive.TestArchive(methodName='runTest')

Bases: TestCase

test_create_tar_basic()
test_create_tar_bz2_basic()
test_create_tar_gz_basic()
test_dirs_refused()
test_executable_preserved()
test_setuid_setgid_refused()
test_tar_gz_name()
mozpack.test.test_archive.file_hash(path)

mozpack.test.test_chrome_flags module

class mozpack.test.test_chrome_flags.TestFlag(methodName='runTest')

Bases: TestCase

test_flag()
test_string_flag()
test_version_flag()
class mozpack.test.test_chrome_flags.TestFlags(methodName='runTest')

Bases: TestCase

setUp()

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

test_flags_match()
test_flags_match_different()
test_flags_match_unset()
test_flags_match_version()
test_flags_str()

mozpack.test.test_chrome_manifest module

mozpack.test.test_copier module

class mozpack.test.test_copier.BaseTestFileRegistry

Bases: MatchTestTemplate

add(path)
do_check(pattern, result)
do_test_file_registry(registry)
do_test_registry_paths(registry)
class mozpack.test.test_copier.TestFileCopier(methodName='runTest')

Bases: TestWithTmpDir

all_dirs(base)
all_files(base)
test_file_copier()
test_no_remove()
test_no_remove_empty_directories()
test_optional_exists_creates_unneeded_directory()

Demonstrate that a directory not strictly required, but specified as the path to an optional file, will be unnecessarily created.

This behaviour is wrong; fixing it is tracked by Bug 972432; and this test exists to guard against unexpected changes in behaviour.

test_permissions()

Ensure files without write permission can be deleted.

Directory symlinks in destination that are not in the way are deleted according to remove_unaccounted and remove_all_directory_symlinks.

test_remove_unaccounted_file_registry()

Test FileCopier.copy(remove_unaccounted=FileRegistry())

Directory symlinks in destination are replaced if they need to be real directories.

class mozpack.test.test_copier.TestFileRegistry(methodName='runTest')

Bases: BaseTestFileRegistry, TestCase

test_file_registry()
test_partial_paths()
test_registry_paths()
test_required_directories()
class mozpack.test.test_copier.TestFileRegistrySubtree(methodName='runTest')

Bases: BaseTestFileRegistry, TestCase

create_registry()
test_file_registry_subtree()
test_file_registry_subtree_base()
test_registry_paths_subtree()
class mozpack.test.test_copier.TestJarrer(methodName='runTest')

Bases: TestCase

check_jar(dest, copier)
test_jarrer()
test_jarrer_compress()

mozpack.test.test_errors module

class mozpack.test.test_errors.TestErrors

Bases: object

get_output()
setUp()
tearDown()
class mozpack.test.test_errors.TestErrorsImpl(methodName='runTest')

Bases: TestErrors, TestCase

test_error_loop()
test_errors_context()
test_ignore_errors()
test_multiple_errors()
test_no_error()
test_plain_error()
test_simple_error()

mozpack.test.test_files module

class mozpack.test.test_files.DestNoWrite(path)

Bases: Dest

write(data)
class mozpack.test.test_files.MatchTestTemplate

Bases: object

do_finder_test(finder)
do_match_test()
prepare_match_test(with_dotfiles=False)
class mozpack.test.test_files.MockDest

Bases: BytesIO, Dest

close()

Disable all I/O operations.

exists()
read(length=-1)

Read at most size bytes, returned as a bytes object.

If the size argument is negative, read until EOF is reached. Return an empty bytes object at EOF.

write(data)

Write bytes to file.

Return the number of bytes written.

class mozpack.test.test_files.TestAbsoluteSymlinkFile(methodName='runTest')

Bases: TestWithTmpDir

test_absolute_relative()
test_noop()
class mozpack.test.test_files.TestComposedFinder(methodName='runTest')

Bases: MatchTestTemplate, TestWithTmpDir

add(path, content=None)
do_check(pattern, result)
test_composed_finder()
class mozpack.test.test_files.TestDeflatedFile(methodName='runTest')

Bases: TestWithTmpDir

test_deflated_file()

Check that DeflatedFile.copy yields the proper content in the destination file in all situations that trigger different code paths (see TestFile.test_file)

test_deflated_file_no_write()

Test various conditions where DeflatedFile.copy is expected not to write in the destination file.

test_deflated_file_open()

Test whether DeflatedFile.open returns an appropriately reset file object.

class mozpack.test.test_files.TestDest(methodName='runTest')

Bases: TestWithTmpDir

test_dest()
class mozpack.test.test_files.TestExistingFile(methodName='runTest')

Bases: TestWithTmpDir

test_optional_existing_dest()
test_optional_missing_dest()
test_required_existing_dest()
test_required_missing_dest()
class mozpack.test.test_files.TestFile(methodName='runTest')

Bases: TestWithTmpDir

test_file()

Check that File.copy yields the proper content in the destination file in all situations that trigger different code paths: - different content - different content of the same size - same content - long content

test_file_dest()

Similar to test_file, but for a destination object instead of a destination file. This ensures the destination object is being used properly by File.copy, ensuring that other subclasses of Dest will work.

test_file_no_write()

Test various conditions where File.copy is expected not to write in the destination file.

test_file_open()

Test whether File.open returns an appropriately reset file object.

class mozpack.test.test_files.TestFileFinder(methodName='runTest')

Bases: MatchTestTemplate, TestWithTmpDir

add(path)
do_check(pattern, result)
test_dotfiles()

Finder can find files beginning with . is configured.

test_dotfiles_plus_ignore()
test_file_finder()
test_get()
test_ignored_dirs()

Ignored directories should not have results returned.

test_ignored_files()

Ignored files should not have results returned.

test_ignored_patterns()

Ignore entries with patterns should be honored.

class mozpack.test.test_files.TestGeneratedFile(methodName='runTest')

Bases: TestWithTmpDir

test_generated_file()

Check that GeneratedFile.copy yields the proper content in the destination file in all situations that trigger different code paths (see TestFile.test_file)

test_generated_file_function()

Test GeneratedFile behavior with functions.

test_generated_file_no_write()

Test various conditions where GeneratedFile.copy is expected not to write in the destination file.

test_generated_file_open()

Test whether GeneratedFile.open returns an appropriately reset file object.

class mozpack.test.test_files.TestHardlinkFile(methodName='runTest')

Bases: TestWithTmpDir

test_absolute_relative()
test_noop()
class mozpack.test.test_files.TestJarFinder(methodName='runTest')

Bases: MatchTestTemplate, TestWithTmpDir

add(path)
do_check(pattern, result)
test_jar_finder()
class mozpack.test.test_files.TestManifestFile(methodName='runTest')

Bases: TestWithTmpDir

test_manifest_file()
class mozpack.test.test_files.TestMercurialRevisionFinder(methodName='runTest')

Bases: MatchTestTemplate, TestWithTmpDir

add(path)
do_check(pattern, result)
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_default_revision()
test_old_revision()
test_recognize_repo_paths()
class mozpack.test.test_files.TestMinifiedCommentStripped(methodName='runTest')

Bases: TestWithTmpDir

test_minified_comment_stripped()
class mozpack.test.test_files.TestMinifiedJavaScript(methodName='runTest')

Bases: TestWithTmpDir

orig_lines = ['// Comment line', 'let foo = "bar";', 'var bar = true;', '', '// Another comment']
test_minified_javascript()
test_minified_verify_failure()
test_minified_verify_success()
class mozpack.test.test_files.TestPreprocessedFile(methodName='runTest')

Bases: TestWithTmpDir

test_preprocess()

Test that copying the file invokes the preprocessor

test_preprocess_file_dependencies()

Test that the preprocess runs if the dependencies of the source change

test_preprocess_file_no_write()

Test various conditions where PreprocessedFile.copy is expected not to write in the destination file.

Test that if the destination exists, and is a symlink, the target of the symlink is not overwritten by the preprocessor output.

class mozpack.test.test_files.TestTarFinder(methodName='runTest')

Bases: MatchTestTemplate, TestWithTmpDir

add(path)
do_check(pattern, result)
test_tar_finder()
class mozpack.test.test_files.TestWithTmpDir(methodName='runTest')

Bases: TestCase

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

tmppath(relpath)
mozpack.test.test_files.do_check(test, finder, pattern, result)

mozpack.test.test_manifests module

class mozpack.test.test_manifests.TestInstallManifest(methodName='runTest')

Bases: TestWithTmpDir

test_add_entries_from()
test_adds()
test_construct()
test_copier_application()
test_malformed()
test_or()
test_pattern_expansion()
test_populate_registry()
test_preprocessor()
test_preprocessor_dependencies()
test_serialization()
test_write_expand_pattern()

mozpack.test.test_mozjar module

class mozpack.test.test_mozjar.TestDeflater(methodName='runTest')

Bases: TestCase

test_deflater_compress()
test_deflater_compress_no_gain()
test_deflater_empty()
test_deflater_no_compress()
wrap(data)
class mozpack.test.test_mozjar.TestDeflaterMemoryView(methodName='runTest')

Bases: TestDeflater

wrap(data)
class mozpack.test.test_mozjar.TestJar(methodName='runTest')

Bases: TestCase

test_add_from_finder()
test_jar()
test_rejar()
class mozpack.test.test_mozjar.TestJarLog(methodName='runTest')

Bases: TestCase

test_jarlog()
class mozpack.test.test_mozjar.TestJarStruct(methodName='runTest')

Bases: TestCase

class Foo(data=None)

Bases: JarStruct

MAGIC = 16909060
STRUCT = {'bar': 'uint16', 'foo': 'uint32', 'length': 'uint16', 'length2': 'uint16', 'qux': 'uint16', 'string': 'length', 'string2': 'length2'}
do_test_read_jar_struct(data)
test_jar_struct()
test_read_jar_struct()
test_read_jar_struct_memoryview()
class mozpack.test.test_mozjar.TestPreload(methodName='runTest')

Bases: TestCase

test_preload()

mozpack.test.test_packager module

class mozpack.test.test_packager.MockFinder(files)

Bases: object

find(path)
class mozpack.test.test_packager.MockFormatter

Bases: object

add(*args)
add_base(*args)
add_interfaces(*args)
add_manifest(*args)
class mozpack.test.test_packager.TestCallDeque(methodName='runTest')

Bases: TestCase

test_call_deque()
class mozpack.test.test_packager.TestComponent(methodName='runTest')

Bases: TestCase

do_from_string(string, name, destdir='')
do_split(string, name, options)
do_split_error(string)
test_component_from_string()
test_component_split_component_and_options()
test_component_split_component_and_options_errors()
class mozpack.test.test_packager.TestPreprocessManifest(methodName='runTest')

Bases: TestCase

EXPECTED_LOG = [(('$OBJDIR/manifest', 2), 'add', '', 'bar/*'), (('$OBJDIR/manifest', 4), 'add', 'foo', 'foo/*'), (('$OBJDIR/manifest', 5), 'remove', 'foo', 'foo/bar'), (('$OBJDIR/manifest', 6), 'add', 'foo', 'chrome.manifest'), (('$OBJDIR/manifest', 8), 'add', 'zot destdir="destdir"', 'foo/zot')]
MANIFEST_PATH = '$OBJDIR/manifest'
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_preprocess_manifest()
test_preprocess_manifest_defines()
test_preprocess_manifest_missing_define()
class mozpack.test.test_packager.TestSimpleManifestSink(methodName='runTest')

Bases: TestCase

test_simple_manifest_parser()
class mozpack.test.test_packager.TestSimplePackager(methodName='runTest')

Bases: TestCase

test_simple_packager()
test_simple_packager_manifest_consistency()

mozpack.test.test_packager_formats module

mozpack.test.test_packager_l10n module

mozpack.test.test_packager_unpack module

mozpack.test.test_path module

class mozpack.test.test_path.TestPath(methodName='runTest')

Bases: TestCase

SEP = '/'
test_basedir()
test_basename()
test_commonprefix()
test_dirname()
test_join()
test_match()
test_normpath()
test_rebase()
test_relpath()
test_split()
test_splitext()

mozpack.test.test_pkg module

class mozpack.test.test_pkg.TestPkg(methodName='runTest')

Bases: TestWithTmpDir

class MockSubprocessRun(returncode=0)

Bases: object

returncode = 0
stderr = ''
stdout = ''
get_relative_glob_list()
maxDiff = None
test_create_bom()
test_create_payload()
test_create_pkg()
test_get_app_info_plist()
test_get_app_info_plist_not_file()
test_get_apple_template()
test_get_apple_template_not_file()
test_save_text_file()
test_xar_package_folder()
test_xar_package_folder_not_absolute()

mozpack.test.test_unify module

class mozpack.test.test_unify.TestUnified(methodName='runTest')

Bases: TestWithTmpDir

create_both(path, content)
create_one(which, path, content)
class mozpack.test.test_unify.TestUnifiedBuildFinder(methodName='runTest')

Bases: TestUnified

test_unified_build_finder()
class mozpack.test.test_unify.TestUnifiedFinder(methodName='runTest')

Bases: TestUnified

test_unified_finder()

Module contents