diff options
Diffstat (limited to '')
-rw-r--r-- | taskcluster/taskgraph/test/conftest.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/taskcluster/taskgraph/test/conftest.py b/taskcluster/taskgraph/test/conftest.py new file mode 100644 index 0000000000..ec8b241439 --- /dev/null +++ b/taskcluster/taskgraph/test/conftest.py @@ -0,0 +1,52 @@ +# Any copyright is dedicated to the public domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +from __future__ import absolute_import + +import os + +import pytest +from mach.logging import LoggingManager +from responses import RequestsMock + +from taskgraph import GECKO +from taskgraph.actions import render_actions_json +from taskgraph.config import load_graph_config +from taskgraph.parameters import Parameters + + +@pytest.fixture +def responses(): + with RequestsMock() as rsps: + yield rsps + + +@pytest.fixture(scope="session", autouse=True) +def patch_prefherder(request): + from _pytest.monkeypatch import MonkeyPatch + + m = MonkeyPatch() + m.setattr( + "taskgraph.util.bugbug._write_perfherder_data", + lambda lower_is_better: None, + ) + yield + m.undo() + + +@pytest.fixture(scope="session", autouse=True) +def enable_logging(): + """Ensure logs from taskgraph are displayed when a test fails.""" + lm = LoggingManager() + lm.add_terminal_logging() + + +@pytest.fixture(scope="session") +def graph_config(): + return load_graph_config(os.path.join(GECKO, "taskcluster", "ci")) + + +@pytest.fixture(scope="session") +def actions_json(graph_config): + decision_task_id = "abcdef" + return render_actions_json(Parameters(strict=False), graph_config, decision_task_id) |