-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: create new 'pytest-taskgraph' package to house test fixtures
These fixtures are useful for any project that wants to test Taskgraph related transforms or scripts. By putting them in a package, we can share them to any other repos that may need them.
- Loading branch information
Showing
28 changed files
with
839 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[project] | ||
name = "pytest-taskgraph" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
authors = [ | ||
{ name = "Andrew Halberstadt", email = "[email protected]" } | ||
] | ||
requires-python = ">=3.8" | ||
dependencies = ["pytest", "taskcluster-taskgraph>=12.1.0"] | ||
|
||
[project.entry-points.pytest11] | ||
pytest-taskgraph = "pytest_taskgraph" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .fixtures.gen import * # noqa | ||
from .fixtures.vcs import * # noqa |
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ LABEL maintainer="Release Engineering <[email protected]>" | |
ENV UV_PROJECT_ENVIRONMENT=/setup/taskgraph | ||
|
||
# %include src | ||
# %include packages | ||
# %include .hatch_build.py | ||
# %include README.rst | ||
# %include pyproject.toml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
from importlib import import_module | ||
|
||
|
||
def register(graph_config): | ||
"""Setup for task generation.""" | ||
# Import sibling modules, triggering decorators in the process | ||
_import_modules( | ||
[ | ||
"custom_parameters", | ||
"custom_target_tasks", | ||
] | ||
) | ||
|
||
|
||
def _import_modules(modules): | ||
for module in modules: | ||
import_module(f".{module}", package=__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
|
||
def decision_parameters(graph_config, parameters): | ||
if parameters["tasks_for"] == "github-release": | ||
parameters["target_tasks_method"] = "release" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from taskgraph.target_tasks import register_target_task, standard_filter | ||
|
||
|
||
@register_target_task("release") | ||
def target_tasks_release(full_task_graph, parameters, graph_config): | ||
tasks = { | ||
l: t for l, t in full_task_graph.tasks.items() if standard_filter(t, parameters) | ||
} | ||
|
||
# Ensure we don't run `taskcluster-taskgraph` release tasks when publishing | ||
# `pytest-taskgraph`. | ||
if parameters["head_ref"].startswith("refs/tags/pytest-taskgraph"): | ||
tasks = { | ||
l: t | ||
for l, t in tasks.items() | ||
if "github-release" not in t.attributes.get("run_on_tasks_for", []) | ||
} | ||
return list(tasks.keys()) |
31 changes: 31 additions & 0 deletions
31
taskcluster/test/params/main-repo-release-pytest-taskgraph.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
base_ref: release-test | ||
base_repository: https://github.com/taskcluster/taskgraph | ||
base_rev: 5fe502ea8fd2a3f21bba2e8b99bb483507cac130 | ||
build_date: 1707294824 | ||
build_number: 1 | ||
do_not_optimize: [] | ||
enable_always_target: true | ||
existing_tasks: {} | ||
files_changed: | ||
- src/taskgraph/decision.py | ||
- test/test_decision.py | ||
filters: | ||
- target_tasks_method | ||
head_ref: refs/tags/pytest-taskgraph-v1.0.0 | ||
head_repository: https://github.com/taskcluster/taskgraph | ||
head_rev: release-test | ||
head_tag: pytest-taskgraph-v1.0.0 | ||
level: '3' | ||
moz_build_date: '20240207083344' | ||
next_version: null | ||
optimize_strategies: null | ||
optimize_target_tasks: true | ||
owner: [email protected] | ||
project: taskgraph | ||
pushdate: 0 | ||
pushlog_id: '0' | ||
repository_type: git | ||
target_tasks_method: release | ||
tasks_for: github-release | ||
version: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.