mozpack.test package

Submodules

mozpack.test.test_archive module

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

Bases: unittest.case.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: unittest.case.TestCase

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

Bases: unittest.case.TestCase

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

mozpack.test.test_chrome_manifest module

class mozpack.test.test_chrome_manifest.TestManifest(methodName='runTest')

Bases: unittest.case.TestCase

test_manifest_rebase()
test_parse_manifest()
class mozpack.test.test_chrome_manifest.TestManifestErrors(methodName='runTest')

Bases: mozpack.test.test_errors.TestErrors, unittest.case.TestCase

test_parse_manifest_errors()

mozpack.test.test_copier module

class mozpack.test.test_copier.BaseTestFileRegistry

Bases: mozpack.test.test_files.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: mozpack.test.test_files.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: mozpack.test.test_copier.BaseTestFileRegistry, unittest.case.TestCase

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

Bases: mozpack.test.test_copier.BaseTestFileRegistry, unittest.case.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: unittest.case.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: mozpack.test.test_errors.TestErrors, unittest.case.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: mozpack.files.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: _io.BytesIO, mozpack.files.Dest

close()
exists()
read(length=-1)
write(data)
class mozpack.test.test_files.TestAbsoluteSymlinkFile(methodName='runTest')

Bases: mozpack.test.test_files.TestWithTmpDir

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

Bases: mozpack.test.test_files.MatchTestTemplate, mozpack.test.test_files.TestWithTmpDir

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

Bases: mozpack.test.test_files.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: mozpack.test.test_files.TestWithTmpDir

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

Bases: mozpack.test.test_files.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: mozpack.test.test_files.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: mozpack.test.test_files.MatchTestTemplate, mozpack.test.test_files.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: mozpack.test.test_files.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_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: mozpack.test.test_files.TestWithTmpDir

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

Bases: mozpack.test.test_files.MatchTestTemplate, mozpack.test.test_files.TestWithTmpDir

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

Bases: mozpack.test.test_files.TestWithTmpDir

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

Bases: mozpack.test.test_files.TestMercurialRevisionFinder

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

Bases: mozpack.test.test_files.MatchTestTemplate, mozpack.test.test_files.TestWithTmpDir

add(path)
do_check(pattern, result)
setUp()
tearDown()
test_default_revision()
test_old_revision()
test_recognize_repo_paths()
class mozpack.test.test_files.TestMinifiedJavaScript(methodName='runTest')

Bases: mozpack.test.test_files.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.TestMinifiedProperties(methodName='runTest')

Bases: mozpack.test.test_files.TestWithTmpDir

test_minified_properties()
class mozpack.test.test_files.TestPreprocessedFile(methodName='runTest')

Bases: mozpack.test.test_files.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: mozpack.test.test_files.MatchTestTemplate, mozpack.test.test_files.TestWithTmpDir

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

Bases: unittest.case.TestCase

setUp()
tearDown()
tmppath(relpath)
class mozpack.test.test_files.TestXPTFile(methodName='runTest')

Bases: mozpack.test.test_files.TestWithTmpDir

test_xpt_file()
mozpack.test.test_files.do_check(test, finder, pattern, result)
mozpack.test.test_files.read_interfaces(file)

mozpack.test.test_manifests module

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

Bases: mozpack.test.test_files.TestWithTmpDir

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

mozpack.test.test_mozjar module

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

Bases: unittest.case.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: mozpack.test.test_mozjar.TestDeflater

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

Bases: unittest.case.TestCase

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

Bases: unittest.case.TestCase

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

Bases: unittest.case.TestCase

class Foo(data=None)

Bases: mozpack.mozjar.JarStruct

MAGIC = 16909060
STRUCT = OrderedDict([('foo', 'uint32'), ('bar', 'uint16'), ('qux', 'uint16'), ('length', 'uint16'), ('length2', '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.TestOptimizeJar(methodName='runTest')

Bases: mozpack.test.test_mozjar.TestJar

optimize = True
class mozpack.test.test_mozjar.TestPreload(methodName='runTest')

Bases: unittest.case.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: unittest.case.TestCase

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

Bases: unittest.case.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: unittest.case.TestCase

EXPECTED_LOG = [(('/builds/worker/checkouts/gecko/manifest', 2), 'add', '', 'bar/*'), (('/builds/worker/checkouts/gecko/manifest', 4), 'add', 'foo', 'foo/*'), (('/builds/worker/checkouts/gecko/manifest', 5), 'remove', 'foo', 'foo/bar'), (('/builds/worker/checkouts/gecko/manifest', 6), 'add', 'foo', 'chrome.manifest'), (('/builds/worker/checkouts/gecko/manifest', 8), 'add', 'zot destdir="destdir"', 'foo/zot')]
MANIFEST_PATH = '/builds/worker/checkouts/gecko/manifest'
setUp()
test_preprocess_manifest()
test_preprocess_manifest_defines()
test_preprocess_manifest_missing_define()
class mozpack.test.test_packager.TestSimpleManifestSink(methodName='runTest')

Bases: unittest.case.TestCase

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

Bases: unittest.case.TestCase

test_simple_packager()
test_simple_packager_manifest_consistency()

mozpack.test.test_packager_formats module

class mozpack.test.test_packager_formats.MockDest

Bases: mozpack.test.test_files.MockDest

exists()
class mozpack.test.test_packager_formats.TestFormatters(methodName='runTest')

Bases: mozpack.test.test_errors.TestErrors, unittest.case.TestCase

do_test_contents(formatter, contents)
maxDiff = None
test_bases()
test_chrome_override()
test_flat_formatter()
test_flat_formatter_with_base()
test_jar_formatter()
test_jar_formatter_with_base()
test_omnijar_formatter()
test_omnijar_formatter_with_base()
test_omnijar_is_resource()
mozpack.test.test_packager_formats.fill_formatter(formatter, contents)
mozpack.test.test_packager_formats.get_contents(registry, read_all=False)
mozpack.test.test_packager_formats.result_with_base(results)

mozpack.test.test_packager_l10n module

class mozpack.test.test_packager_l10n.TestL10NRepack(methodName='runTest')

Bases: unittest.case.TestCase

test_l10n_repack()

mozpack.test.test_packager_unpack module

class mozpack.test.test_packager_unpack.TestUnpack(methodName='runTest')

Bases: mozpack.test.test_files.TestWithTmpDir

maxDiff = None
classmethod setUpClass()
test_flat_unpack()
test_jar_unpack()
test_omnijar_unpack()

mozpack.test.test_path module

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

Bases: unittest.case.TestCase

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

Module contents