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¶
mozpack.test.test_chrome_manifest module¶
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.
- test_remove_unaccounted_directory_symlinks()¶
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())
- test_symlink_directory_replaced()¶
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()¶
mozpack.test.test_errors module¶
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()¶
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:
mozpack.test.test_files.TestWithTmpDir
- test_absolute_relative()¶
- test_noop()¶
- test_replace_file_with_symlink()¶
- test_replace_symlink()¶
- test_symlink_file()¶
- 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_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:
mozpack.test.test_files.TestWithTmpDir
- test_absolute_relative()¶
- test_hardlink_file()¶
- test_noop()¶
- test_replace_file_with_hardlink()¶
- test_replace_hardlink()¶
- 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.TestMercurialRevisionFinder(methodName='runTest')¶
Bases:
mozpack.test.test_files.MatchTestTemplate
,mozpack.test.test_files.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:
mozpack.test.test_files.TestWithTmpDir
- test_minified_comment_stripped()¶
- 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.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_replace_symlink()¶
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()¶
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:
mozpack.test.test_files.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:
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
- 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 = {'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()¶
mozpack.test.test_packager module¶
- 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 = [(('$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()¶
mozpack.test.test_packager_formats module¶
mozpack.test.test_packager_l10n module¶
mozpack.test.test_packager_unpack module¶
mozpack.test.test_path module¶
mozpack.test.test_pkg module¶
- class mozpack.test.test_pkg.TestPkg(methodName='runTest')¶
Bases:
mozpack.test.test_files.TestWithTmpDir
- 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:
mozpack.test.test_files.TestWithTmpDir
- create_both(path, content)¶
- create_one(which, path, content)¶
- class mozpack.test.test_unify.TestUnifiedBuildFinder(methodName='runTest')¶
Bases:
mozpack.test.test_unify.TestUnified
- test_unified_build_finder()¶
- class mozpack.test.test_unify.TestUnifiedFinder(methodName='runTest')¶
Bases:
mozpack.test.test_unify.TestUnified
- test_unified_finder()¶