From 5a790206b49d19a169d1e8c38ba77623801b749a Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 22 Sep 2019 13:54:53 +0000 Subject: [PATCH] Bug 1573987 - allow tests to run without TASKCLUSTER_ROOT_URL; r=Callek Differential Revision: https://phabricator.services.mozilla.com/D44551 --- taskcluster/ci/tests/kind.yml | 4 ++++ tcadmin/tests/test_util_scopes.py | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/taskcluster/ci/tests/kind.yml b/taskcluster/ci/tests/kind.yml index 025aeaaf..c3a19825 100644 --- a/taskcluster/ci/tests/kind.yml +++ b/taskcluster/ci/tests/kind.yml @@ -37,6 +37,10 @@ jobs: description: "Run `unit tests` to validate the latest changes" treeherder: symbol: unit + worker: + env: + # fail instead of skipping tests due to missing information + NO_TEST_SKIP: 1 run: command: [python, setup.py, test] flake8: diff --git a/tcadmin/tests/test_util_scopes.py b/tcadmin/tests/test_util_scopes.py index da755408..f97c0dd9 100644 --- a/tcadmin/tests/test_util_scopes.py +++ b/tcadmin/tests/test_util_scopes.py @@ -6,6 +6,7 @@ import pytest import taskcluster +import os from tcadmin.util.scopes import Resolver, satisfies from tcadmin.resources import Role, Resources @@ -225,6 +226,14 @@ def test_normalizeScopes_with_stars(): @pytest.fixture(scope="module") def auth(): + # tests using this fixture need *some* auth service, but it actually + # doesn't matter which one + if "TASKCLUSTER_ROOT_URL" not in os.environ: + msg = "TASKCLUSTER_ROOT_URL not set" + if "NO_TEST_SKIP" in os.environ: + pytest.fail(msg) + else: + pytest.skip(msg) return taskcluster.Auth(taskcluster.optionsFromEnvironment())