taskgraph.test package

Submodules

taskgraph.test.conftest module

taskgraph.test.conftest.enable_logging()

Ensure logs from taskgraph are displayed when a test fails.

taskgraph.test.conftest.patch_prefherder(request)
taskgraph.test.conftest.responses()

taskgraph.test.test_actions_util module

class taskgraph.test.test_actions_util.TestCombineTaskGraphFiles(methodName='runTest')

Bases: unittest.case.TestCase

test_no_suffixes()
test_one_suffix(rename_artifact)
test_several_suffixes()
class taskgraph.test.test_actions_util.TestRelativize(methodName='runTest')

Bases: unittest.case.TestCase

test_relativize()

taskgraph.test.test_create module

class taskgraph.test.test_create.TestCreate(methodName='runTest')

Bases: unittest.case.TestCase

fake_create_task(session, task_id, label, task_def)
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_create_task_without_dependencies()

a task with no dependencies depends on the decision task

test_create_tasks()
test_create_tasks_fails_if_create_fails(create_task)

creat_tasks fails if a single create_task call fails

taskgraph.test.test_decision module

class taskgraph.test.test_decision.TestDecision(methodName='runTest')

Bases: unittest.case.TestCase

test_write_artifact_json()
test_write_artifact_yml()
class taskgraph.test.test_decision.TestGetDecisionParameters(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

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

test_no_email_owner(mock_get_hg_revision_branch)
test_simple_options(mock_get_hg_revision_branch)
test_try_options(mock_get_hg_commit_message, mock_get_hg_revision_branch)
test_try_syntax_from_message_embedded_try_syntax_multiline()
test_try_syntax_from_message_empty()
test_try_syntax_from_message_initial_try_syntax()
test_try_syntax_from_message_initial_try_syntax_multiline()
test_try_syntax_from_message_no_try_syntax()
test_try_task_config(mock_get_hg_commit_message, mock_get_hg_revision_branch)
ttc_file = '/builds/worker/checkouts/gecko/try_task_config.json'

taskgraph.test.test_files_changed module

class taskgraph.test.test_files_changed.FakeResponse

Bases: object

json()
class taskgraph.test.test_files_changed.TestCheck(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.

test_check_match()
test_check_no_match()
test_check_no_params()
class taskgraph.test.test_files_changed.TestGetChangedFiles(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.

test_get_changed_files()

Get_changed_files correctly gets the list of changed files in a push. This tests against the production hg.mozilla.org so that it will detect any changes in the format of the returned data.

taskgraph.test.test_generator module

class taskgraph.test.test_generator.FakeKind(name: str, path: str, config: dict, graph_config: taskgraph.config.GraphConfig)

Bases: taskgraph.generator.Kind

load_tasks(parameters, loaded_tasks, write_artifacts)
class taskgraph.test.test_generator.FakeOptimization(mode, *args, **kwargs)

Bases: taskgraph.optimize.OptimizationStrategy

should_remove_task(task, params, arg)

Determine whether to optimize this task by removing it. Returns True to remove.

class taskgraph.test.test_generator.FakeParameters

Bases: dict

strict = True
class taskgraph.test.test_generator.TestGenerator(methodName='runTest')

Bases: unittest.case.TestCase

maketgg(target_tasks=None, kinds=['_fake', []], params=None)
patch(monkeypatch)
test_always_target_tasks()

The target_task_graph includes tasks with ‘always_target’

test_full_task_graph()

The full_task_graph property has all tasks, and links

test_full_task_set()

The full_task_set property has all tasks

test_kind_ordering()

When task kinds depend on each other, they are loaded in postorder

test_optimized_task_graph()

The optimized task graph contains task ids

test_target_task_graph()

The target_task_graph property has the targeted tasks and deps

test_target_task_set()

The target_task_set property has the targeted tasks

class taskgraph.test.test_generator.WithFakeKind(root_dir, parameters, decision_task_id='DECISION-TASK', write_artifacts=False)

Bases: taskgraph.generator.TaskGraphGenerator

taskgraph.test.test_generator.fake_load_graph_config(root_dir)
taskgraph.test.test_generator.fake_loader(kind, path, config, parameters, loaded_tasks)
taskgraph.test.test_generator.test_load_tasks_for_kind(monkeypatch)

load_tasks_for_kinds will load the tasks for the provided kind

taskgraph.test.test_graph module

class taskgraph.test.test_graph.TestGraph(methodName='runTest')

Bases: unittest.case.TestCase

assert_postorder(seq, all_nodes)
assert_preorder(seq, all_nodes)
diamonds = Graph(nodes=frozenset({'H', 'C', 'F', 'A', 'I', 'J', 'D', 'B', 'G', 'E'}), edges=frozenset({('A', 'F', 'L'), ('A', 'D', 'L'), ('E', 'H', 'L'), ('D', 'F', 'L'), ('H', 'J', 'L'), ('G', 'I', 'L'), ('B', 'E', 'L'), ('D', 'G', 'L'), ('G', 'J', 'L'), ('C', 'H', 'L'), ('B', 'D', 'L'), ('F', 'I', 'L'), ('C', 'E', 'L'), ('E', 'G', 'L')}))
disjoint = Graph(nodes=frozenset({'4', 'γ', '3', '2', 'α', 'β', '1'}), edges=frozenset({('2', '1', 'red'), ('3', '1', 'red'), ('α', 'β', 'πράσινο'), ('4', '3', 'green'), ('3', '2', 'green'), ('β', 'γ', 'κόκκινο'), ('α', 'γ', 'μπλε')}))
linear = Graph(nodes=frozenset({'3', '2', '1', '4'}), edges=frozenset({('3', '4', 'L'), ('1', '2', 'L'), ('2', '3', 'L')}))
multi_edges = Graph(nodes=frozenset({'3', '2', '1', '4'}), edges=frozenset({('2', '1', 'red'), ('3', '1', 'red'), ('3', '2', 'blue'), ('4', '3', 'green'), ('2', '1', 'blue'), ('3', '2', 'green')}))

link dict for a graph with multiple edges is correct

named link dict for a graph with multiple edges is correct

reverse link dict for a graph with multiple edges is correct

test_transitive_closure_disjoint()

transitive closure of a disjoint set is a subset

test_transitive_closure_disjoint_edges()

transitive closure of a disjoint graph keeps those edges

test_transitive_closure_empty()

transitive closure of an empty set is an empty graph

test_transitive_closure_linear()

transitive closure of a linear graph includes all nodes in the line

test_transitive_closure_multi_edges()

transitive closure of a tree with multiple edges between nodes keeps those edges

test_transitive_closure_trees()

transitive closure of a tree, at two non-root nodes, is the two subtrees

test_visit_postorder_diamonds()

postorder visit of a graph full of diamonds satisfies invariant

test_visit_postorder_disjoint()

postorder visit of a disjoint graph satisfies invariant

test_visit_postorder_empty()

postorder visit of an empty graph is empty

test_visit_postorder_multi_edges()

postorder visit of a graph with duplicate edges satisfies invariant

test_visit_postorder_tree()

postorder visit of a tree satisfies invariant

test_visit_preorder_diamonds()

preorder visit of a graph full of diamonds satisfies invariant

test_visit_preorder_disjoint()

preorder visit of a disjoint graph satisfies invariant

test_visit_preorder_multi_edges()

preorder visit of a graph with duplicate edges satisfies invariant

test_visit_preorder_tree()

preorder visit of a tree satisfies invariant

tree = Graph(nodes=frozenset({'b', 'f', 'e', 'd', 'c', 'g', 'a'}), edges=frozenset({('c', 'g', 'N'), ('b', 'd', 'K'), ('c', 'f', 'N'), ('b', 'e', 'K'), ('a', 'b', 'L'), ('a', 'c', 'L')}))

taskgraph.test.test_morph module

taskgraph.test.test_morph.graph_config()
taskgraph.test.test_morph.make_taskgraph()
taskgraph.test.test_morph.test_make_index_tasks(make_taskgraph, graph_config)

taskgraph.test.test_optimize module

class taskgraph.test.test_optimize.Remove

Bases: taskgraph.optimize.OptimizationStrategy

should_remove_task(task, params, arg)

Determine whether to optimize this task by removing it. Returns True to remove.

class taskgraph.test.test_optimize.Replace

Bases: taskgraph.optimize.OptimizationStrategy

should_replace_task(task, params, taskid)

Determine whether to optimize this task by replacing it. Returns a taskId to replace this task, True to replace with nothing, or False to keep the task.

taskgraph.test.test_optimize.default_strategies()
taskgraph.test.test_optimize.make_graph(*tasks_and_edges, **kwargs)
taskgraph.test.test_optimize.make_opt_graph(*tasks_and_edges)
taskgraph.test.test_optimize.make_task(label, optimization=None, task_def=None, optimized=None, task_id=None, dependencies=None, if_dependencies=None)
taskgraph.test.test_optimize.make_triangle(deps=True, **opts)

Make a “triangle” graph like this:

t1 <——– t3

`—- t2 –’

taskgraph.test.test_optimize.test_get_subgraph(monkeypatch, graph, kwargs, exp_subgraph, exp_label_to_taskid)

Tests the get_subgraph function.

Each test case takes 4 arguments:

  1. A TaskGraph instance.

  2. Keyword arguments to pass into get_subgraph.

  3. The expected subgraph.

  4. The expected label_to_taskid.

taskgraph.test.test_optimize.test_get_subgraph_removed_dep()

get_subgraph raises an Exception when a task depends on a removed task

taskgraph.test.test_optimize.test_remove_tasks(monkeypatch, graph, kwargs, exp_removed)

Tests the remove_tasks function.

Each test case takes three arguments:

  1. A TaskGraph instance.

  2. Keyword arguments to pass into remove_tasks.

  3. The set of task labels that are expected to be removed.

taskgraph.test.test_optimize.test_replace_tasks(graph, kwargs, exp_replaced, exp_removed, exp_label_to_taskid)

Tests the replace_tasks function.

Each test case takes five arguments:

  1. A TaskGraph instance.

  2. Keyword arguments to pass into replace_tasks.

  3. The set of task labels that are expected to be replaced.

  4. The set of task labels that are expected to be removed.

  5. The expected label_to_taskid.

taskgraph.test.test_optimize_strategies module

taskgraph.test.test_optimize_strategies.clear_push_schedules_memoize()
taskgraph.test.test_optimize_strategies.generate_tasks(*tasks)
taskgraph.test.test_optimize_strategies.idfn(param)
taskgraph.test.test_optimize_strategies.params()
taskgraph.test.test_optimize_strategies.test_backstop(params)
taskgraph.test.test_optimize_strategies.test_bugbug_fallback(monkeypatch, responses, params)
taskgraph.test.test_optimize_strategies.test_bugbug_multiple_pushes(responses, params)
taskgraph.test.test_optimize_strategies.test_bugbug_push_schedules(responses, params, args, data, expected)
taskgraph.test.test_optimize_strategies.test_bugbug_timeout(monkeypatch, responses, params)
taskgraph.test.test_optimize_strategies.test_expanded(params)
taskgraph.test.test_optimize_strategies.test_optimization_strategy(responses, params, opt, tasks, arg, expected)
taskgraph.test.test_optimize_strategies.test_project_autoland_test(monkeypatch, responses, params)

Tests the behaviour of the project.autoland[“test”] strategy on various types of pushes.

taskgraph.test.test_optimize_strategies.test_push_interval(params)

taskgraph.test.test_parameters module

class taskgraph.test.test_parameters.TestCommParameters(methodName='runTest')

Bases: unittest.case.TestCase

test_Parameters_check()

Specifying all of the gecko and comm parameters doesn’t result in an error.

test_Parameters_check_extra()

If parameters other than the global and comm parameters are specified, an error is reported.

test_Parameters_check_missing()

If any of the comm parameters are specified, all of them must be specified.

vals = {'app_version': 'app_version', 'backstop': False, 'base_repository': 'base_repository', 'build_date': 0, 'build_number': 0, 'comm_base_repository': 'comm_base_repository', 'comm_head_ref': 'comm_head_ref', 'comm_head_repository': 'comm_head_repository', 'comm_head_rev': 'comm_head_rev', 'do_not_optimize': [], 'existing_tasks': {}, 'filters': [], 'head_ref': 'head_ref', 'head_repository': 'head_repository', 'head_rev': 'head_rev', 'hg_branch': 'hg_branch', 'level': 'level', 'message': 'message', 'moz_build_date': 'moz_build_date', 'next_version': 'next_version', 'optimize_strategies': None, 'optimize_target_tasks': False, 'owner': 'owner', 'phabricator_diff': 'phabricator_diff', 'project': 'project', 'pushdate': 0, 'pushlog_id': 'pushlog_id', 'release_enable_emefree': False, 'release_enable_partner_attribution': False, 'release_enable_partner_repack': False, 'release_eta': None, 'release_history': {}, 'release_partner_build_number': 1, 'release_partner_config': None, 'release_partners': [], 'release_product': None, 'release_type': 'release_type', 'required_signoffs': [], 'signoff_urls': {}, 'target_tasks_method': 'target_tasks_method', 'tasks_for': 'tasks_for', 'test_manifest_loader': 'default', 'try_mode': 'try_mode', 'try_options': None, 'try_task_config': {}, 'version': 'version'}
class taskgraph.test.test_parameters.TestParameters(methodName='runTest')

Bases: unittest.case.TestCase

test_Parameters_check()
test_Parameters_check_extra()
test_Parameters_check_missing()
test_Parameters_get()
test_Parameters_immutable()
test_Parameters_invalid_KeyError()

even if the value is present, if it’s not a valid property, raise KeyError

test_Parameters_missing_KeyError()
test_load_parameters_file_json()
test_load_parameters_file_yaml()
test_load_parameters_override()

When load_parameters_file is passed overrides, they are included in the generated parameters.

test_load_parameters_override_file()

When load_parameters_file is passed overrides, they overwrite data loaded from a file.

vals = {'app_version': 'app_version', 'backstop': False, 'base_repository': 'base_repository', 'build_date': 0, 'build_number': 0, 'do_not_optimize': [], 'existing_tasks': {}, 'filters': [], 'head_ref': 'head_ref', 'head_repository': 'head_repository', 'head_rev': 'head_rev', 'hg_branch': 'hg_branch', 'level': 'level', 'message': 'message', 'moz_build_date': 'moz_build_date', 'next_version': 'next_version', 'optimize_strategies': None, 'optimize_target_tasks': False, 'owner': 'owner', 'phabricator_diff': 'phabricator_diff', 'project': 'project', 'pushdate': 0, 'pushlog_id': 'pushlog_id', 'release_enable_emefree': False, 'release_enable_partner_attribution': False, 'release_enable_partner_repack': False, 'release_eta': None, 'release_history': {}, 'release_partner_build_number': 1, 'release_partner_config': None, 'release_partners': [], 'release_product': None, 'release_type': 'release_type', 'required_signoffs': [], 'signoff_urls': {}, 'target_tasks_method': 'target_tasks_method', 'tasks_for': 'tasks_for', 'test_manifest_loader': 'default', 'try_mode': 'try_mode', 'try_options': None, 'try_task_config': {}, 'version': 'version'}

taskgraph.test.test_target_tasks module

class taskgraph.test.test_target_tasks.FakeTryOptionSyntax(message, task_graph, graph_config)

Bases: object

task_matches(task)
class taskgraph.test.test_target_tasks.TestTargetTasks(methodName='runTest')

Bases: unittest.case.TestCase

default_matches(attributes, parameters)
default_matches_hg_branch(run_on_hg_branches, hg_branch)
default_matches_project(run_on_projects, project)
fake_TryOptionSyntax()
make_task_graph()
test_default_all()

run_on_projects=[all] includes release, integration, and other projects

test_default_hg_branch()
test_default_integration()

run_on_projects=[integration] includes integration projects

test_default_nothing()

run_on_projects=[] includes nothing

test_default_release()

run_on_projects=[release] includes release projects

test_empty_try()

try_mode = None runs nothing

test_try_option_syntax()

try_mode = try_option_syntax uses TryOptionSyntax

test_try_task_config()

try_mode = try_task_config uses the try config

taskgraph.test.test_taskcluster_yml module

class taskgraph.test.test_taskcluster_yml.TestTaskclusterYml(methodName='runTest')

Bases: unittest.case.TestCase

property taskcluster_yml
test_action()
test_cron()
test_push()
test_unknown()

taskgraph.test.test_taskgraph module

class taskgraph.test.test_taskgraph.TestTaskGraph(methodName='runTest')

Bases: unittest.case.TestCase

maxDiff = None
simple_graph = TaskGraph(tasks={'a': Task(kind='fancy', label='a', attributes={'kind': 'fancy'}, task={'task': 'def'}, description='', task_id=None, optimization={'skip-unless-has-relevant-tests': None}, dependencies={'prereq': 'b'}, soft_dependencies=[], if_dependencies=[], release_artifacts=None), 'b': Task(kind='pre', label='b', attributes={'kind': 'pre'}, task={'task': 'def2'}, description='', task_id=None, optimization={'skip-unless-has-relevant-tests': None}, dependencies={}, soft_dependencies=[], if_dependencies=[], release_artifacts=None)}, graph=Graph(nodes=frozenset({'b', 'a'}), edges=frozenset({('a', 'b', 'prereq')})))
test_contains()
test_round_trip()
test_taskgraph_to_json()

taskgraph.test.test_transforms_base module

class taskgraph.test.test_transforms_base.TestTransformSequence(methodName='runTest')

Bases: unittest.case.TestCase

test_sequence()
taskgraph.test.test_transforms_base.trans1(config, tests)
taskgraph.test.test_transforms_base.trans2(config, tests)

taskgraph.test.test_transforms_job module

Tests for the ‘job’ transform subsystem.

taskgraph.test.test_transforms_job.config()
taskgraph.test.test_transforms_job.test_worker_caches(task, transform)
taskgraph.test.test_transforms_job.transform(monkeypatch, config)

Run the job transforms on the specified task but return the inputs to configure_taskdesc_for_run without executing it.

This gives test functions an easy way to generate the inputs required for many of the run_using subsystems.

taskgraph.test.test_try_option_syntax module

class taskgraph.test.test_try_option_syntax.TestTryOptionSyntax(methodName='runTest')

Bases: unittest.case.TestCase

test_all_email()

–all-emails sets notifications

test_apostrophe_in_message()

apostrophe does not break parsing

test_artifact()

–artifact sets artifact to true

test_b_d()

-b d should produce build_types=[‘debug’]

test_b_do()

-b do should produce both build_types

test_b_dx()

-b dx should produce build_types=[‘debug’], silently ignoring the x

test_b_o()

-b o should produce build_types=[‘opt’]

test_build_o()

–build o should produce build_types=[‘opt’]

test_fail_email()

–failure-emails sets notifications

test_interactive()

–interactive sets interactive

test_j_all()

-j all sets jobs=None

test_j_job()

-j somejob sets jobs=[‘somejob’]

test_j_jobs()

-j job1,job2 sets jobs=[‘job1’, ‘job2’]

test_j_twice()

-j job1 -j job2 sets jobs=job1, job2

test_no_email()

no email settings don’t set notifications

test_no_retry()

–no-retry sets no_retry to true

test_p_all()

-p all sets platforms=None

test_p_expands_ridealongs()

-p linux,linux64 includes the RIDEALONG_BUILDS

test_p_linux()

-p linux sets platforms=[‘linux’, ‘linux-ridealong’]

test_p_linux_win32()

-p linux,win32 sets platforms=[‘linux’, ‘linux-ridealong’, ‘win32’]

test_profile()

–gecko-profile sets profile to true

test_setenv()

–setenv VAR=value adds a environment variables setting to env

test_t_all()

-t all sets talos=[..whole list..]

test_t_none()

-t none sets talos=[]

test_t_single()

-t mochitest-webgl sets talos=[mochitest-webgl]

test_tag()

–tag TAG sets tag to TAG value

test_talos_trigger_tests()

–rebuild-talos 10 sets talos_trigger_tests

test_trigger_tests()

–rebuild 10 sets trigger_tests

test_u_alias()

-u mochitest-gl sets unittests=[mochitest-webgl*]

test_u_all()

-u all sets unittests=[..whole list..]

test_u_chunks()

-u gtest-3,gtest-4 selects the third and fourth chunk of gtest

test_u_chunks_platforms()

-u gtest-1[linux,win32] selects the linux and win32 platforms for chunk 1 of gtest

test_u_commas()

-u mochitest-webgl1-core,gtest sets unittests=both

test_u_multi_alias()

-u e10s sets unittests=[all e10s unittests]

test_u_none()

-u none sets unittests=[]

test_u_platform()

-u gtest[linux] selects the linux platform for gtest

test_u_platforms()

-u gtest[linux,win32] selects the linux and win32 platforms for gtest

test_u_platforms_negated()

-u gtest[-linux] selects all platforms but linux for gtest

test_u_platforms_negated_pretty()

-u gtest[Ubuntu,-x64] selects just linux for gtest

test_u_platforms_pretty()

-u gtest[Ubuntu] selects the linux, linux64 and linux64-asan platforms for gtest

test_u_single()

-u mochitest-webgl1-core sets unittests=[mochitest-webgl1-core]

test_unknown_args()

unknown arguments are ignored

taskgraph.test.test_try_option_syntax.talos_task(n, tp, bt='opt')
taskgraph.test.test_try_option_syntax.unittest_task(n, tp, bt='opt')

taskgraph.test.test_util_attributes module

class taskgraph.test.test_util_attributes.Attrmatch(methodName='runTest')

Bases: unittest.case.TestCase

test_all_matches_required()

If only one attribute does not match, the result is False

test_callable_attribute()

Callable attributes are called and any False causes the match to fail

test_literal_attribute()

Literal attributes must match exactly

test_missing_attribute()

If a filtering attribute is not present, no match

test_set_attribute()

Set attributes require set membership

test_trivial_match()

Given no conditions, anything matches

class taskgraph.test.test_util_attributes.MatchRunOnProjects(methodName='runTest')

Bases: unittest.case.TestCase

test_all()
test_combo()
test_empty()
test_integration()
test_release()

taskgraph.test.test_util_backstop module

taskgraph.test.test_util_backstop.params()
taskgraph.test.test_util_backstop.test_is_backstop(responses, params)

taskgraph.test.test_util_bugbug module

taskgraph.test.test_util_bugbug.test_group_translation(responses)

taskgraph.test.test_util_chunking module

taskgraph.test.test_util_chunking.mock_manifest_runtimes()

Deterministically produce a list of simulated manifest runtimes.

Parameters

manifests (list) – list of manifests against which simulated manifest runtimes would be paired up to.

Returns

dict of manifest data paired with a float value representing runtime.

taskgraph.test.test_util_chunking.mock_mozinfo()

Returns a mocked mozinfo object, similar to guess_mozinfo_from_task().

Parameters
  • os (str) – typically one of ‘win, linux, mac, android’.

  • processor (str) – processor architecture.

  • asan (bool, optional) – addressanitizer build.

  • bits (int, optional) – defaults to 64.

  • ccov (bool, optional) – code coverage build.

  • debug (bool, optional) – debug type build.

  • fission (bool, optional) – process fission.

  • headless (bool, optional) – headless browser testing without displays.

  • tsan (bool, optional) – threadsanitizer build.

Returns

Dictionary mimickign the results from guess_mozinfo_from_task.

Return type

dict

taskgraph.test.test_util_chunking.mock_task_definition()

Builds a mock task definition for use in testing.

Parameters
  • platform (str) – represents the build platform.

  • bits (int) – software bits.

  • build_type (str) – opt or debug.

  • suite (str) – name of the unittest suite.

  • test_platform (str, optional) – full name of the platform and major version.

  • variant (str, optional) – specify fission or vanilla.

Returns

mocked task definition.

Return type

dict

taskgraph.test.test_util_chunking.test_chunk_manifests(suite, platform, chunks, mock_mozinfo)

Tests chunking with real manifests.

taskgraph.test.test_util_chunking.test_get_manifests(suite, platform, mock_mozinfo)

Tests the DefaultLoader class’ ability to load manifests.

taskgraph.test.test_util_chunking.test_get_runtimes(platform, suite)

Tests that runtime information is returned for known good configurations.

taskgraph.test.test_util_chunking.test_get_runtimes_invalid(platform, suite, exception)

Ensure get_runtimes() method raises an exception if improper request is made.

taskgraph.test.test_util_chunking.test_guess_mozinfo_from_task(params, exception, mock_task_definition)

Tests the mozinfo guessing process.

taskgraph.test.test_util_chunking.test_mock_chunk_manifests(mock_manifest_runtimes, unchunked_manifests, suite, chunks)

Tests non-WPT tests and its subsuites chunking process.

taskgraph.test.test_util_chunking.test_mock_chunk_manifests_wpt(unchunked_manifests, suite, chunks)

Tests web-platform-tests and its subsuites chunking process.

taskgraph.test.test_util_chunking.unchunked_manifests()

Produce a list of unchunked manifests to be consumed by test method.

Parameters
  • length (int, optional) – number of path elements to keep.

  • cutoff (int, optional) – number of generated test paths to remove from the test set if user wants to limit the number of paths.

Returns

list of test paths.

Return type

list

taskgraph.test.test_util_docker module

class taskgraph.test.test_util_docker.TestDocker(methodName='runTest')

Bases: unittest.case.TestCase

test_create_context_absolute_path()
test_create_context_extra_directory()
test_create_context_missing_extra()
test_create_context_outside_topsrcdir()
test_create_context_tar_basic()
test_create_context_topsrcdir_files()
test_docker_image_default_registry()
test_docker_image_default_registry_by_tag()
test_docker_image_explicit_registry()
test_docker_image_explicit_registry_by_tag()
test_generate_context_hash()

taskgraph.test.test_util_parameterization module

class taskgraph.test.test_util_parameterization.TestArtifactRefs(methodName='runTest')

Bases: unittest.case.TestCase

do(input, output)
test_badly_formed()

resolve_task_references ignores badly-formatted artifact references

test_decision()

resolve_task_references resolves decision to the provided decision task id

test_in_dict()

resolve_task_references resolves artifact references in a dict

test_in_list()

resolve_task_references resolves artifact references in a list

test_in_string()

resolve_task_references resolves artifact references embedded in a string

test_invalid()

resolve_task_references raises a KeyError on reference to an invalid task

test_self()

resolve_task_references raises KeyError on artifact references to self

class taskgraph.test.test_util_parameterization.TestTaskRefs(methodName='runTest')

Bases: unittest.case.TestCase

do(input, output)
test_decision()

resolve_task_references resolves decision to the provided decision task id

test_embedded()

resolve_task_references resolves ebmedded references

test_escaping()

resolve_task_references resolves escapes in task references

test_in_dict()

resolve_task_references resolves task references in a dict

test_in_list()

resolve_task_references resolves task references in a list

test_invalid()

resolve_task_references raises a KeyError on reference to an invalid task

test_multikey()

resolve_task_references is ignored when there is another key in the dict

test_multiple()

resolve_task_references resolves multiple references in the same string

test_no_change()

resolve_task_references does nothing when there are no task references

test_self()

resolve_task_references resolves self to the provided task id

class taskgraph.test.test_util_parameterization.TestTimestamps(methodName='runTest')

Bases: unittest.case.TestCase

test_appears_with_other_keys()
test_buried_replacement()
test_no_change()

taskgraph.test.test_util_python_path module

class taskgraph.test.test_util_python_path.TestObject

Bases: object

testClassProperty = <object object>
class taskgraph.test.test_util_python_path.TestPythonPath(methodName='runTest')

Bases: unittest.case.TestCase

test_find_object_exists()

find_object finds an existing object

test_find_object_no_such_module()

find_object raises ImportError for a nonexistent module

test_find_object_no_such_object()

find_object raises AttributeError for a nonexistent object

taskgraph.test.test_util_runnable_jobs module

class taskgraph.test.test_util_runnable_jobs.TestRunnableJobs(methodName='runTest')

Bases: unittest.case.TestCase

make_taskgraph(tasks)
tasks = [{'kind': 'build', 'label': 'a', 'attributes': {}, 'task': {'extra': {'treeherder': {'symbol': 'B'}}}}, {'kind': 'test', 'label': 'b', 'attributes': {}, 'task': {'extra': {'treeherder': {'collection': {'opt': True}, 'groupName': 'Some group', 'groupSymbol': 'GS', 'machine': {'platform': 'linux64'}, 'symbol': 't'}}}}]
test_taskgraph_to_runnable_jobs()

taskgraph.test.test_util_schema module

class taskgraph.test.test_util_schema.TestCheckSchema(methodName='runTest')

Bases: unittest.case.TestCase

test_extend_schema()

Extending a schema applies taskgraph checks.

test_extend_schema_twice()

Extending a schema twice applies taskgraph checks.

test_schema()

Creating a schema applies taskgraph checks.

class taskgraph.test.test_util_schema.TestResolveKeyedBy(methodName='runTest')

Bases: unittest.case.TestCase

test_match_default()
test_match_extra_value()
test_match_nested_exact()
test_match_partial_regexp()
test_match_regexp()
test_multiple_matches()
test_nested()
test_no_by()
test_no_by_dotted()
test_no_by_empty_dict()
test_no_by_not_by()
test_no_by_not_dict()
test_no_by_not_only_by()
test_no_key()

When the key referenced in by-* doesn’t exist, and there is a default value, that value is used as the result.

test_no_key_no_default()

When the key referenced in by-* doesn’t exist, and there is not default value, an exception is raised.

test_no_match()
class taskgraph.test.test_util_schema.TestValidateSchema(methodName='runTest')

Bases: unittest.case.TestCase

test_invalid()
test_valid()

taskgraph.test.test_util_taskcluster module

class taskgraph.test.test_util_taskcluster.TestTCUtils(methodName='runTest')

Bases: unittest.case.TestCase

test_parse_time()

taskgraph.test.test_util_templates module

class taskgraph.test.test_util_templates.MergeTest(methodName='runTest')

Bases: unittest.case.TestCase

test_merge()
test_merge_by()
test_merge_diff_types()
test_merge_multiple_by()
test_merge_to_dicts()
test_merge_to_lists()

taskgraph.test.test_util_time module

class taskgraph.test.test_util_time.FromNowTest(methodName='runTest')

Bases: unittest.case.TestCase

test_invalid_str()
test_json_from_now()
test_json_from_now_utc_now()
test_missing_unit()
test_missing_unknown_unit()
test_value_of()

taskgraph.test.test_util_treeherder module

class taskgraph.test.test_util_treeherder.TestSymbols(methodName='runTest')

Bases: unittest.case.TestCase

test_add_suffix_no_group()
test_add_suffix_with_group()
test_join_no_group()
test_join_with_group()
test_split_no_group()
test_split_with_group()

taskgraph.test.test_util_verify module

There are some basic tests run as part of the Decision task to make sure documentation exists for taskgraph functionality. These functions are defined in taskgraph.generator and call taskgraph.util.verify.verify_docs with different parameters to do the actual checking.

class taskgraph.test.test_util_verify.PyTestSingleDocPath

Bases: object

Taskcluster documentation for Firefox is in a single directory. Check the tests running at build time to make sure documentation exists, actually work themselves.

pytestmark = [Mark(name='usefixtures', args=('mock_single_doc_path',), kwargs={})]
test_heading()

Look for a headings in filename matching identifiers. This is used when making sure documentation exists for kinds and attributes.

test_inline_literal()

Look for inline-literals in filename. Used when checking documentation for decision task parameters and run-using functions.

class taskgraph.test.test_util_verify.PyTestTwoDocPaths

Bases: object

Thunderbird extends Firefox’s taskgraph with additional kinds. The documentation for Thunderbird kinds are in its repository, and documentation_paths will have two places to look for files. Run the same tests as for a single documentation path, and cover additional possible scenarios.

pytestmark = [Mark(name='usefixtures', args=('mock_two_doc_paths',), kwargs={})]
test_heading()

Look for a headings in filename matching identifiers. This is used when making sure documentation exists for kinds and attributes. The first test looks for headings that are all within the first doc path, the second test is new and has a heading found in the second path. The final check has a identifier that will not match and should produce an error.

test_inline_literal()

Look for inline-literals in filename. Used when checking documentation for decision task parameters and run-using functions. As with the heading tests, the second check looks for an identifier in the added documentation path.

taskgraph.test.test_util_verify.mock_single_doc_path(monkeypatch)

Set a single path containing documentation

taskgraph.test.test_util_verify.mock_two_doc_paths(monkeypatch)

Set two paths containing documentation

taskgraph.test.test_util_yaml module

class taskgraph.test.test_util_yaml.TestYaml(methodName='runTest')

Bases: unittest.case.TestCase

test_load()

Module contents