gecko_taskgraph.test package

Submodules

gecko_taskgraph.test.conftest module

class gecko_taskgraph.test.conftest.FakeKind(name: str, path: str, config: Dict, graph_config: GraphConfig)

Bases: Kind

static create(name, extra_config, graph_config)
load_tasks(parameters, loaded_tasks, write_artifacts)
class gecko_taskgraph.test.conftest.FakeOptimization(mode, *args, **kwargs)

Bases: OptimizationStrategy

description = 'Fake strategy for testing'
should_remove_task(task, params, arg)

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

class gecko_taskgraph.test.conftest.FakeParameters

Bases: dict

file_url(path, pretty=False)
strict = True
class gecko_taskgraph.test.conftest.FakeTransform

Bases: object

classmethod get(field, default)
params = {}
transforms = []
class gecko_taskgraph.test.conftest.FakeTransformConfig(**kwargs)

Bases: object

config = {}
graph_config = {}
kind = 'fake-kind'
kind_dependencies_tasks = {}
params = {}
path = '/root/ci/fake-kind'
write_artifacts = False
class gecko_taskgraph.test.conftest.WithFakeKind(root_dir, parameters, decision_task_id='DECISION-TASK', write_artifacts=False)

Bases: TaskGraphGenerator

gecko_taskgraph.test.conftest.actions_json(graph_config)
gecko_taskgraph.test.conftest.enable_logging()

Ensure logs from gecko_taskgraph are displayed when a test fails.

gecko_taskgraph.test.conftest.fake_load_graph_config(root_dir)
gecko_taskgraph.test.conftest.fake_loader(kind, path, config, parameters, loaded_tasks)
gecko_taskgraph.test.conftest.graph_config()
gecko_taskgraph.test.conftest.maketgg(monkeypatch)
gecko_taskgraph.test.conftest.patch_prefherder(request)
gecko_taskgraph.test.conftest.responses()
gecko_taskgraph.test.conftest.run_full_config_transform()
gecko_taskgraph.test.conftest.run_transform()

gecko_taskgraph.test.test_actions_util module

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

Bases: TestCase

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

Bases: TestCase

test_relativize()
gecko_taskgraph.test.test_actions_util.enable_test_mode()
gecko_taskgraph.test.test_actions_util.is_subset(subset, superset)
gecko_taskgraph.test.test_actions_util.test_extract_applicable_action(responses, monkeypatch, actions_json, task_def, expected)

gecko_taskgraph.test.test_decision module

gecko_taskgraph.test.test_decision.options()
gecko_taskgraph.test.test_decision.register()
gecko_taskgraph.test.test_decision.test_get_decision_parameters(mock_get_changed_files, mock_determine_more_accurate_base_rev, mock_get_hg_commit_message, mock_get_hg_revision_branch, options, extra_options, commit_msg, ttc, expected)
gecko_taskgraph.test.test_decision.test_try_syntax_from_message(msg, expected)
gecko_taskgraph.test.test_decision.test_write_artifact_json()
gecko_taskgraph.test.test_decision.test_write_artifact_yml()

gecko_taskgraph.test.test_files_changed module

class gecko_taskgraph.test.test_files_changed.FakeResponse

Bases: object

json()
class gecko_taskgraph.test.test_files_changed.TestCheck(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_check_match()
test_check_no_match()
test_check_no_params()
class gecko_taskgraph.test.test_files_changed.TestGetChangedFiles(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_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.

gecko_taskgraph.test.test_main module

gecko_taskgraph.test.test_main.run_main(maketgg, monkeypatch)
gecko_taskgraph.test.test_main.test_output_file(run_main, tmpdir)
gecko_taskgraph.test.test_main.test_show_taskgraph(run_main, capsys, attr, expected)
gecko_taskgraph.test.test_main.test_tasks_regex(run_main, capsys)

gecko_taskgraph.test.test_morph module

gecko_taskgraph.test.test_morph.make_taskgraph()
gecko_taskgraph.test.test_morph.test_make_index_tasks(make_taskgraph, graph_config)
gecko_taskgraph.test.test_morph.test_try_task_duplicates(make_taskgraph, graph_config, params, expected)

gecko_taskgraph.test.test_optimize_strategies module

gecko_taskgraph.test.test_optimize_strategies.clear_push_schedules_memoize()
gecko_taskgraph.test.test_optimize_strategies.generate_tasks(*tasks)
gecko_taskgraph.test.test_optimize_strategies.idfn(param)
gecko_taskgraph.test.test_optimize_strategies.params()
gecko_taskgraph.test.test_optimize_strategies.test_backstop(params)
gecko_taskgraph.test.test_optimize_strategies.test_bugbug_fallback(monkeypatch, responses, params)
gecko_taskgraph.test.test_optimize_strategies.test_bugbug_multiple_pushes(responses, params)
gecko_taskgraph.test.test_optimize_strategies.test_bugbug_push_schedules(responses, params, args, data, expected)
gecko_taskgraph.test.test_optimize_strategies.test_bugbug_timeout(monkeypatch, responses, params)
gecko_taskgraph.test.test_optimize_strategies.test_expanded(params)
gecko_taskgraph.test.test_optimize_strategies.test_optimization_strategy_remove(params, opt, tasks, arg, expected)
gecko_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.

gecko_taskgraph.test.test_optimize_strategies.test_push_interval(params)

gecko_taskgraph.test.test_target_tasks module

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

Bases: object

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

Bases: 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

test_try_task_config_absolute()

try_mode = try_task_config uses the try config with full task labels

test_try_task_config_regex()

try_mode = try_task_config uses the try config with regex instead of chunk numbers

test_try_task_config_regex_var()

try_mode = try_task_config uses the try config with regex instead of chunk numbers and a test variant

test_try_task_config_regex_with_paths()

try_mode = try_task_config uses the try config with regex instead of chunk numbers

gecko_taskgraph.test.test_target_tasks.test_filters(name, params, expected)

gecko_taskgraph.test.test_taskcluster_yml module

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

Bases: TestCase

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

gecko_taskgraph.test.test_transforms_build_schedules module

gecko_taskgraph.test.test_transforms_build_schedules.test_build_schedules(run_transform, kind, task, expected)

gecko_taskgraph.test.test_transforms_job module

Tests for the ‘job’ transform subsystem.

gecko_taskgraph.test.test_transforms_job.config()
gecko_taskgraph.test.test_transforms_job.test_worker_caches(task, transform)
gecko_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.

gecko_taskgraph.test.test_transforms_test module

Tests for the ‘tests.py’ transforms

gecko_taskgraph.test.test_transforms_test.assert_spi_disabled(task)
gecko_taskgraph.test.test_transforms_test.assert_spi_not_disabled(task)
gecko_taskgraph.test.test_transforms_test.make_test_task()

Create a test task definition with required default values.

gecko_taskgraph.test.test_transforms_test.test_ensure_spi_disabled_on_all_but_spi(make_test_task, run_transform, task, callback)
gecko_taskgraph.test.test_transforms_test.test_set_test_setting(run_transform, task, expected)
gecko_taskgraph.test.test_transforms_test.test_split_variants(monkeypatch, run_full_config_transform, make_test_task)

gecko_taskgraph.test.test_try_option_syntax module

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

Bases: 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

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

gecko_taskgraph.test.test_util_attributes module

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

Bases: 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 gecko_taskgraph.test.test_util_attributes.MatchRunOnProjects(methodName='runTest')

Bases: TestCase

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

gecko_taskgraph.test.test_util_backstop module

gecko_taskgraph.test.test_util_backstop.params()
gecko_taskgraph.test.test_util_backstop.test_is_backstop(responses, params, response_args, extra_params, expected)

gecko_taskgraph.test.test_util_bugbug module

gecko_taskgraph.test.test_util_bugbug.test_group_translation(responses)

gecko_taskgraph.test.test_util_chunking module

gecko_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.

gecko_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

gecko_taskgraph.test.test_util_chunking.mock_task_definition()

Builds a mock task definition for use in testing.

Parameters:
  • os_name (str) – represents the os.

  • os_version (str) – represents the os version

  • bits (int) – software bits.

  • build_type (str) – opt or debug.

  • build_attrs (list, optional) – specify build attribute(s)

  • variants (list, optional) – specify runtime variant(s)

Returns:

mocked task definition.

Return type:

dict

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

Tests chunking with real manifests.

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

Tests the DefaultLoader class’ ability to load manifests.

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

Tests that runtime information is returned for known good configurations.

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

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

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

Tests the mozinfo guessing process.

gecko_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.

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

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

gecko_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

gecko_taskgraph.test.test_util_docker module

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

Bases: 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()

gecko_taskgraph.test.test_util_partials module

class gecko_taskgraph.test.test_util_partials.TestReleaseHistory(methodName='runTest')

Bases: TestCase

test_populate_release_history(get_sorted_releases, get_release_builds)
gecko_taskgraph.test.test_util_partials.nightly_blob(release)

gecko_taskgraph.test.test_util_runnable_jobs module

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

Bases: TestCase

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

gecko_taskgraph.test.test_util_templates module

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

Bases: TestCase

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

gecko_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 gecko_taskgraph.generator and call gecko_taskgraph.util.verify.verify_docs with different parameters to do the actual checking.

class gecko_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 gecko_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.

gecko_taskgraph.test.test_util_verify.mock_single_doc_path(monkeypatch)

Set a single path containing documentation

gecko_taskgraph.test.test_util_verify.mock_two_doc_paths(monkeypatch)

Set two paths containing documentation

Module contents