mozbuild.test package

Subpackages

Submodules

mozbuild.test.common module

class mozbuild.test.common.MockConfig(topsrcdir='/path/to/topsrcdir', extra_substs={}, error_is_fatal=True)

Bases: object

mozbuild.test.common.prepare_tmp_topsrcdir(path)

mozbuild.test.test_android_version_code module

class mozbuild.test.test_android_version_code.TestAndroidVersionCode(methodName='runTest')

Bases: TestCase

test_android_version_code_v0()
test_android_version_code_v0_relative_v1()

Verify that the first v1 code is greater than the equivalent v0 code.

test_android_version_code_v1()
test_android_version_code_v1_overflow()

Verify that it is an error to ask for v1 codes that actually does overflow.

test_android_version_code_v1_running_low()

Verify there is an informative message if one asks for v1 codes that are close to overflow.

test_android_version_code_v1_underflow()

Verify that it is an error to ask for v1 codes predating the cutoff.

mozbuild.test.test_artifact_cache module

class mozbuild.test.test_artifact_cache.FakeResponse(content)

Bases: object

close()
property headers
iter_content(chunk_size)
raise_for_status()
class mozbuild.test.test_artifact_cache.FakeSession

Bases: object

get(url, stream=True)
class mozbuild.test.test_artifact_cache.TestArtifactCache(methodName='runTest')

Bases: TestCase

listtmpdir()
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_artifact_cache_persistence()
utime(path, times)

mozbuild.test.test_artifacts module

class mozbuild.test.test_artifacts.FakeArtifactJob(log=None, download_tests=True, download_symbols=False, download_maven_zip=False, substs=None, mozbuild=None)

Bases: ArtifactJob

package_re = ''
class mozbuild.test.test_artifacts.FakeThunderbirdJob(log=None, download_tests=True, download_symbols=False, download_maven_zip=False, substs=None, mozbuild=None)

Bases: ThunderbirdMixin, FakeArtifactJob

class mozbuild.test.test_artifacts.TestArtifactJob(methodName='runTest')

Bases: TestCase

test_candidate_trees_with_beta_version()
test_candidate_trees_with_empty_file()
test_candidate_trees_with_esr_version()
test_candidate_trees_with_newline_before_version()
test_candidate_trees_with_nightly_version()
test_candidate_trees_with_release_version()
test_property_is_cached()
class mozbuild.test.test_artifacts.TestThunderbirdMixin(methodName='runTest')

Bases: TestCase

test_candidate_trees_with_beta_version()
test_candidate_trees_with_esr_version()
test_candidate_trees_with_nightly_version()
test_candidate_trees_with_release_version()
test_property_is_cached()

mozbuild.test.test_base module

class mozbuild.test.test_base.TestMozbuildObject(methodName='runTest')

Bases: TestCase

get_base(topobjdir=None)
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_config_environment()
test_get_binary_path()
test_mach_command_base_inside_objdir()

Ensure a MachCommandBase constructed from inside the objdir works.

test_objdir_config_guess()
test_objdir_config_status()

Ensure @CONFIG_GUESS@ is handled when loading mozconfig.

test_objdir_is_srcdir_rejected()

Ensure the srcdir configurations are rejected.

test_objdir_mismatch()

Ensure MachCommandBase throwing on objdir mismatch.

test_objdir_trailing_slash()

Trailing slashes in topobjdir should be removed.

test_relative_objdir()

Relative defined objdirs are loaded properly.

Objdir that is a symlink is loaded properly.

class mozbuild.test.test_base.TestPathArgument(methodName='runTest')

Bases: TestCase

test_path_argument()

mozbuild.test.test_containers module

class mozbuild.test.test_containers.TestKeyedDefaultDict(methodName='runTest')

Bases: TestCase

test_defaults()
test_simple()
class mozbuild.test.test_containers.TestList(methodName='runTest')

Bases: TestCase

test_add_list()
test_add_string()
test_none()

As a special exception, we allow None to be treated as an empty list.

class mozbuild.test.test_containers.TestOrderedDefaultDict(methodName='runTest')

Bases: TestCase

test_defaults()
test_simple()
class mozbuild.test.test_containers.TestReadOnlyDefaultDict(methodName='runTest')

Bases: TestCase

test_assignment()
test_defaults()
test_simple()
class mozbuild.test.test_containers.TestReadOnlyDict(methodName='runTest')

Bases: TestCase

test_basic()
test_del()
test_update()
class mozbuild.test.test_containers.TestReadOnlyKeyedDefaultDict(methodName='runTest')

Bases: TestCase

test_defaults()
class mozbuild.test.test_containers.TestReadOnlyNamespace(methodName='runTest')

Bases: TestCase

test_basic()

mozbuild.test.test_dotproperties module

class mozbuild.test.test_dotproperties.TestDotProperties(methodName='runTest')

Bases: TestCase

test_bad_unicode_from_file()
test_get()
test_get_dict()
test_get_dict_with_shared_prefix()
test_get_dict_with_value_prefix()
test_get_list()
test_get_list_with_shared_prefix()
test_unicode()
test_update()
test_valid_unicode_from_file()

mozbuild.test.test_expression module

class mozbuild.test.test_expression.TestContext(methodName='runTest')

Bases: TestCase

Unit tests for the Context class

setUp()

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

test_in()

test ‘var in context’ to not fall for fallback

test_string_literal()

test string literal, fall-through for undefined var in a Context

test_variable()

test value for defined var in the Context class

class mozbuild.test.test_expression.TestExpression(methodName='runTest')

Bases: TestCase

Unit tests for the Expression class evaluate() is called with a context {FAIL: ‘PASS’}

setUp()

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

test_defined()

Test for the defined() value

test_equals()

Test for the == operator

test_logical_and()

Test for the && operator

test_logical_ops()

Test for the && and || operators precedence

test_logical_or()

Test for the || operator

test_not()

Test for the ! operator

test_notequals()

Test for the != operator

test_string_literal()

Test for a string literal in an Expression

test_variable()

Test for variable value in an Expression

mozbuild.test.test_jarmaker module

class mozbuild.test.test_jarmaker.TestJarMaker(methodName='runTest')

Bases: TestCase

Unit tests for JarMaker.py

debug = False
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_a_simple_jar()

Test a simple jar.mn

Test a simple jar.mn with a symlink

test_a_wildcard_jar()

Test a wildcard in jar.mn

Test a wildcard in jar.mn with symlinks

class mozbuild.test.test_jarmaker.Test_fluent(methodName='runTest')

Bases: TestCase

Unit tests for JarMaker interaction with Fluent

debug = False
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_l10n_not_merge_ftl()

Test that JarMaker doesn’t merge source .ftl files

class mozbuild.test.test_jarmaker.Test_relativesrcdir(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.

test_en_US()
test_l10n_merge()
test_l10n_no_merge()
test_override()
test_override_l10n()

mozbuild.test.test_licenses module

class mozbuild.test.test_licenses.TestLicenses(methodName='runTest')

Bases: TestCase

Unit tests for the Rust Vendoring stuff

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

testLicense()

mozbuild.test.test_line_endings module

class mozbuild.test.test_line_endings.TestLineEndings(methodName='runTest')

Bases: TestCase

Unit tests for the Context class

createFile(lineendings)
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

testMac()
testUnix()
testWindows()

mozbuild.test.test_makeutil module

class mozbuild.test.test_makeutil.TestMakefile(methodName='runTest')

Bases: TestCase

test_makefile()
test_path_normalization()
test_read_dep_makefile()
test_rule()
test_statement()
test_write_dep_makefile()

mozbuild.test.test_manifest module

class mozbuild.test.test_manifest.TestManifest(methodName='runTest')

Bases: TestCase

process_test_vectors(test_vectors)
test_json()
test_malformed()
test_revision()
test_schema()
test_simple()
test_updatebot()

mozbuild.test.test_mozconfig module

class mozbuild.test.test_mozconfig.TestMozconfigLoader(methodName='runTest')

Bases: TestCase

get_loader()
get_temp_dir()
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_read_ac_options_substitution()

Ensure ac_add_options values are substituted.

test_read_capture_ac_options()

Ensures ac_add_options calls are captured.

test_read_capture_mk_options()

Ensures mk_add_options calls are captured.

test_read_capture_mk_options_objdir_environ()

Ensures mk_add_options calls are captured and override the environ.

test_read_empty_mozconfig()
test_read_empty_mozconfig_objdir_environ()
test_read_empty_variable_value()

Ensure empty variable values are parsed properly.

test_read_exported_variables()

Exported variables are caught as new variables.

test_read_load_exception()

Ensure non-0 exit codes in mozconfigs are handled properly.

test_read_modify_variables()

Variables modified by mozconfig are detected.

test_read_moz_objdir_substitution()

Ensure @TOPSRCDIR@ substitution is recognized in MOZ_OBJDIR.

test_read_multiline_variables()

Ensure multi-line variables are captured properly.

test_read_new_variables()

New variables declared in mozconfig file are detected.

test_read_no_mozconfig()
test_read_no_mozconfig_objdir_environ()
test_read_removed_variables()

Variables unset by the mozconfig are detected.

test_read_topsrcdir_defined()

Ensure $topsrcdir references work as expected.

test_read_unmodified_variables()

Variables modified by mozconfig are detected.

mozbuild.test.test_mozinfo module

class mozbuild.test.test_mozinfo.Base

Bases: object

class mozbuild.test.test_mozinfo.TestBuildDict(methodName='runTest')

Bases: TestCase, Base

test_android()
test_arm()

Test that all arm CPU architectures => arm.

test_crashreporter()

Test that crashreporter values are properly detected.

test_debug()

Test that debug values are properly detected.

test_linux()
test_mac()
test_missing()

Test that missing required values raises.

test_unknown()

Test that unknown values pass through okay.

test_win()
test_x86()

Test that various i?86 values => x86.

class mozbuild.test.test_mozinfo.TestWriteMozinfo(methodName='runTest')

Bases: TestCase, Base

Test the write_mozinfo function.

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_basic()

Test that writing to a file produces correct output.

test_fileobj()

Test that writing to a file-like object produces correct output.

mozbuild.test.test_preprocessor module

class mozbuild.test.test_preprocessor.TestPreprocessor(methodName='runTest')

Bases: TestCase

Unit tests for the Context class

do_include_compare(content_lines, expected_lines)
do_include_pass(content_lines)
setUp()

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

test_ambigous_command()
test_command_line_literal_at()
test_conditional_if_0()
test_conditional_if_0_elif_1()
test_conditional_if_0_or_1()
test_conditional_if_1()
test_conditional_if_1_elif_1_else()
test_conditional_if_1_if_1()
test_conditional_not_0()
test_conditional_not_0_and_1()
test_conditional_not_1()
test_conditional_not_emptyval()
test_conditional_not_nullval()
test_default_defines()
test_error()
test_expand()
test_filterDefine()
test_filter_attemptSubstitution()
test_filter_dumbComments()
test_filter_dumbComments_and_emptyLines()
test_filter_emptyLines()
test_filter_substitution()
test_include()
test_include_line()
test_include_literal_at()
test_include_missing_file()
test_include_undefined_variable()
test_indentation()
test_invalid_ifdef()
test_javascript_line()
test_literal()
test_no_marker()
test_number_value()
test_number_value_equals()
test_number_value_equals_defines()
test_number_value_not_equals_quoted_defines()
test_octal_value_equals()
test_octal_value_equals_defines()
test_octal_value_not_equals_quoted_defines()
test_octal_value_quoted_expansion()
test_string_value()
test_undef_defined()
test_undef_undefined()
test_undefined_variable()
test_value_quoted_expansion()

Quoted values on the commandline don’t currently have quotes stripped. Pike says this is for compat reasons.

test_var_directory()
test_var_file()
test_var_if_0()
test_var_if_0_elifdef()
test_var_if_0_elifndef()
test_var_ifdef_0()
test_var_ifdef_1_or_undef()
test_var_ifdef_undef()
test_var_ifndef_0()
test_var_ifndef_0_and_undef()
test_var_ifndef_undef()
test_var_line()

mozbuild.test.test_pythonutil module

mozbuild.test.test_pythonutil.test_iter_modules_in_path()

mozbuild.test.test_rewrite_mozbuild module

class mozbuild.test.test_rewrite_mozbuild.TestUtils(methodName='runTest')

Bases: TestCase

test_filenames_directory_is_in_filename_list()
test_find_all_posible_assignments_from_filename()
test_guess_best_assignment()
test_mozbuild_adding()
test_mozbuild_adding_internal()
test_mozbuild_removing()
test_mozbuild_removing_internal()
test_normalize_filename()
test_unnormalize_filename()

mozbuild.test.test_telemetry module

mozbuild.test.test_telemetry.test_path_filtering()
mozbuild.test.test_telemetry.test_path_filtering_in_objdir()
mozbuild.test.test_telemetry.test_path_filtering_other_cwd(tmpdir)

mozbuild.test.test_telemetry_settings module

class mozbuild.test.test_telemetry_settings.OtherSettings

Bases: object

config_settings = [('foo.bar', 'int', '', 1), ('build.abc', 'string', '', '')]
mozbuild.test.test_telemetry_settings.load_settings_file(mozbuild_path, settings)
mozbuild.test.test_telemetry_settings.record_enabled_telemetry(mozbuild_path, settings)
mozbuild.test.test_telemetry_settings.settings()
mozbuild.test.test_telemetry_settings.test_existing_build_section(tmpdir, settings)
mozbuild.test.test_telemetry_settings.test_file_exists_no_build_section(tmpdir, settings)
mozbuild.test.test_telemetry_settings.test_initialize_new_contributor_allow_telemetry(settings)
mozbuild.test.test_telemetry_settings.test_initialize_new_contributor_deny_telemetry(settings)
mozbuild.test.test_telemetry_settings.test_initialize_new_employee(settings)
mozbuild.test.test_telemetry_settings.test_initialize_noop_when_request_error(settings)
mozbuild.test.test_telemetry_settings.test_initialize_noop_when_telemetry_disabled_env(monkeypatch)
mozbuild.test.test_telemetry_settings.test_malformed_file(tmpdir, settings)

Ensure that a malformed config file doesn’t cause breakage.

mozbuild.test.test_telemetry_settings.test_nonexistent(tmpdir, settings)
mozbuild.test.test_telemetry_settings.test_resolve_is_employee()
mozbuild.test.test_telemetry_settings.write_config(mozbuild_path, contents)

mozbuild.test.test_util module

class mozbuild.test.test_util.TestEnumString(methodName='runTest')

Bases: TestCase

test_string()
class mozbuild.test.test_util.TestGroupUnifiedFiles(methodName='runTest')

Bases: TestCase

FILES = ['a.cpp', 'b.cpp', 'c.cpp', 'd.cpp', 'e.cpp', 'f.cpp', 'g.cpp', 'h.cpp', 'i.cpp', 'j.cpp', 'k.cpp', 'l.cpp', 'm.cpp', 'n.cpp', 'o.cpp', 'p.cpp', 'q.cpp', 'r.cpp', 's.cpp', 't.cpp', 'u.cpp', 'v.cpp', 'w.cpp', 'x.cpp', 'y.cpp', 'z.cpp']
test_multiple_files()
class mozbuild.test.test_util.TestHashing(methodName='runTest')

Bases: TestCase

test_hash_file_known_hash()

Ensure a known hash value is recreated.

test_hash_file_large()

Ensure that hash_file seems to work with a large file.

class mozbuild.test.test_util.TestHexDump(methodName='runTest')

Bases: TestCase

test_hexdump()
class mozbuild.test.test_util.TestHierarchicalStringList(methodName='runTest')

Bases: TestCase

setUp()

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

test_del_exports()
test_exports_append()
test_exports_multiple_subdir()
test_exports_subdir()
test_invalid_exports_append()
test_invalid_exports_append_base()
test_invalid_exports_bool()
test_invalid_exports_set()
test_merge()
test_reassign()
test_unsorted()
test_walk()
class mozbuild.test.test_util.TestMemoize(methodName='runTest')

Bases: TestCase

test_memoize()
test_memoize_method()
test_memoized_property()
class mozbuild.test.test_util.TestMisc(methodName='runTest')

Bases: TestCase

test_expand_variables()
test_pair()
class mozbuild.test.test_util.TestResolveTargetToMake(methodName='runTest')

Bases: TestCase

assertResolve(path, expected)
setUp()

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

test_Makefile()
test_dir()
test_regular_file()
test_root_path()
test_top_level()
class mozbuild.test.test_util.TestStrictOrderingOnAppendList(methodName='runTest')

Bases: TestCase

test_add()
test_add_StrictOrderingOnAppendList()
test_add_after_iadd()
test_extend()
test_iadd()
test_init()
test_slicing()
class mozbuild.test.test_util.TestStrictOrderingOnAppendListWithAction(methodName='runTest')

Bases: TestCase

assertSameList(expected, actual)
setUp()

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

test_add()
test_extend()
test_iadd()
test_init()
test_slicing()
class mozbuild.test.test_util.TestStrictOrderingOnAppendListWithFlagsFactory(methodName='runTest')

Bases: TestCase

test_strict_ordering_on_append_list_with_flags_factory()
test_strict_ordering_on_append_list_with_flags_factory_extend()
class mozbuild.test.test_util.TestTypedList(methodName='runTest')

Bases: TestCase

test_add()
test_add_coercion()
test_extend()
test_iadd()
test_init()
test_memoized()
test_slicing()
class mozbuild.test.test_util.TestTypedNamedTuple(methodName='runTest')

Bases: TestCase

test_simple()
class mozbuild.test.test_util.TypedTestStrictOrderingOnAppendList(methodName='runTest')

Bases: TestCase

test_init()
mozbuild.test.test_util.test_read_only_dict()

mozbuild.test.test_util_fileavoidwrite module

Tests for the FileAvoidWrite object.

mozbuild.test.test_util_fileavoidwrite.test_change_binary_file_contents(tmp_path)
mozbuild.test.test_util_fileavoidwrite.test_diff_not_created_by_default(tmp_path)
mozbuild.test.test_util_fileavoidwrite.test_diff_update(tmp_path)
mozbuild.test.test_util_fileavoidwrite.test_no_write_happens_if_file_contents_same(tmp_path)
mozbuild.test.test_util_fileavoidwrite.test_obj_as_context_manager(tmp_path)
mozbuild.test.test_util_fileavoidwrite.test_overwrite_contents(tmp_path)
mozbuild.test.test_util_fileavoidwrite.test_store_new_contents(tmp_path)
mozbuild.test.test_util_fileavoidwrite.test_write_unicode(tmp_path)
mozbuild.test.test_util_fileavoidwrite.tmp_path(tmpdir)

Backport of the tmp_path fixture from pytest 3.9.1.

mozbuild.test.test_vendor module

mozbuild.test.test_vendor.test_up_to_date_vendor()

mozbuild.test.test_vendor_tools module

mozbuild.test.test_vendor_tools.test_list_of_paths_to_readable_string()

Module contents