Bug 1466211 - Run taskgraph tests using pipenv; r?ahal draft
authorDave Hunt <dhunt@mozilla.com>
Fri, 01 Jun 2018 18:38:35 +0100
changeset 804943 2270c2a45f8c69b287716ccfa288c2242c598761
parent 804942 ef2dc75937c8fd01b3415a261a66406fd78a64db
child 804944 834aafeaa5375577f555ac2ef6c350b1e16a6db2
push id112505
push userbmo:dave.hunt@gmail.com
push dateWed, 06 Jun 2018 20:48:11 +0000
reviewersahal
bugs1466211
milestone62.0a1
Bug 1466211 - Run taskgraph tests using pipenv; r?ahal MozReview-Commit-ID: 1V7jOltmRue
python/Pipfile
python/Pipfile.lock
taskcluster/setup.py
taskcluster/taskgraph/__init__.py
taskcluster/taskgraph/morph.py
taskcluster/taskgraph/test/__init__.py
taskcluster/taskgraph/test/test_util_python_path.py
--- a/python/Pipfile
+++ b/python/Pipfile
@@ -5,16 +5,17 @@ name = "pypi"
 
 [packages]
 "d5b4a14" = {path = "./mach"}
 "8ddb376" = {path = "./mozbuild"}
 "8b3b8fb" = {path = "./mozlint"}
 "b3ddbcf" = {path = "./mozterm"}
 "38a4a9a" = {path = "./mozversioncontrol"}
 "26d92fb" = {path = "./../config/mozunit"}
+"5942084" = {path = "./../taskcluster"}
 "99247d1" = {path = "./../testing/marionette/client"}
 "c6b7cc8" = {path = "./../testing/marionette/harness"}
 "cea2946" = {path = "./../testing/mozbase/manifestparser"}
 "ffcf6e6" = {path = "./../testing/mozbase/mozcrash"}
 "195ae2e" = {path = "./../testing/mozbase/mozdebug"}
 "8dab59a" = {path = "./../testing/mozbase/mozdevice"}
 "58d0848" = {path = "./../testing/mozbase/mozfile"}
 "fd0b608" = {path = "./../testing/mozbase/mozhttpd"}
@@ -24,21 +25,27 @@ name = "pypi"
 "e09e103" = {path = "./../testing/mozbase/moznetwork"}
 "132adec" = {path = "./../testing/mozbase/mozprocess"}
 "d88f467" = {path = "./../testing/mozbase/mozprofile"}
 "1de94f2" = {path = "./../testing/mozbase/mozrunner"}
 "6477f20" = {path = "./../testing/mozbase/moztest"}
 "f1d74ca" = {path = "./../testing/mozbase/mozversion"}
 "a90d08e" = {path = "./../testing/raptor"}
 "0bc49c9" = {path = "./../testing/web-platform/tests/tools/wptserve"}
+"1a59da0" = {path = "./../third_party/python/attrs"}
 "b017005" = {path = "./../third_party/python/blessings"}
 "605c6a6" = {path = "./../third_party/python/browsermob-proxy"}
 "47200d8" = {path = "./../third_party/python/futures", markers="python_version < '3'"}
 "110bcc4" = {path = "./../third_party/python/jsmin"}
+"dcaaf6a" = {path = "./../third_party/python/json-e"}
 "c49d32a" = {path = "./../third_party/python/mock-1.0.0", markers="python_version < '3.3'"}
 "c2c21d9" = {path = "./../third_party/python/py"}
 "f4b00e9" = {path = "./../third_party/python/pytest"}
 "b1adf4f" = {path = "./../third_party/python/pyyaml"}
+"09d375d" = {path = "./../third_party/python/redo"}
 "053111f" = {path = "./../third_party/python/requests"}
 "d250320" = {path = "./../third_party/python/six"}
+"16bd0c6" = {path = "./../third_party/python/requests-unixsocket"}
+"8a4f01a" = {path = "./../third_party/python/slugid"}
+"bddbd22" = {path = "./../third_party/python/voluptuous"}
 "f1de77a" = {path = "./../third_party/python/which", markers="python_version < '3.3'"}
 
 [dev-packages]
--- a/python/Pipfile.lock
+++ b/python/Pipfile.lock
@@ -1,39 +1,48 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "1365b67dedc01b0f0c6f4210e5962312956010bba2b4e91330071417e9ea10bb"
+            "sha256": "2b21ee005096806e2e1021a34297aab0af3b5c81ae81c73efeb316d7adc4145b"
         },
         "pipfile-spec": 6,
         "requires": {},
         "sources": [
             {
                 "name": "pypi",
                 "url": "https://pypi.org/simple",
                 "verify_ssl": true
             }
         ]
     },
     "default": {
         "053111f": {
             "path": "./../third_party/python/requests"
         },
+        "09d375d": {
+            "path": "./../third_party/python/redo"
+        },
         "0bc49c9": {
             "path": "./../testing/web-platform/tests/tools/wptserve"
         },
         "110bcc4": {
             "path": "./../third_party/python/jsmin"
         },
         "132adec": {
             "path": "./../testing/mozbase/mozprocess"
         },
+        "16bd0c6": {
+            "path": "./../third_party/python/requests-unixsocket"
+        },
         "195ae2e": {
             "path": "./../testing/mozbase/mozdebug"
         },
+        "1a59da0": {
+            "path": "./../third_party/python/attrs"
+        },
         "1de94f2": {
             "path": "./../testing/mozbase/mozrunner"
         },
         "26d92fb": {
             "path": "./../config/mozunit"
         },
         "38a4a9a": {
             "path": "./mozversioncontrol"
@@ -43,28 +52,34 @@
             "path": "./../third_party/python/futures"
         },
         "501835d": {
             "path": "./../testing/mozbase/mozinstall"
         },
         "58d0848": {
             "path": "./../testing/mozbase/mozfile"
         },
+        "5942084": {
+            "path": "./../taskcluster"
+        },
         "605c6a6": {
             "path": "./../third_party/python/browsermob-proxy"
         },
         "6477f20": {
             "path": "./../testing/mozbase/moztest"
         },
         "7329809": {
             "path": "./../testing/mozbase/mozinfo"
         },
         "807c1c5": {
             "path": "./../testing/mozbase/mozlog"
         },
+        "8a4f01a": {
+            "path": "./../third_party/python/slugid"
+        },
         "8b3b8fb": {
             "path": "./mozlint"
         },
         "8dab59a": {
             "path": "./../testing/mozbase/mozdevice"
         },
         "8ddb376": {
             "path": "./mozbuild"
@@ -79,16 +94,19 @@
             "path": "./../third_party/python/blessings"
         },
         "b1adf4f": {
             "path": "./../third_party/python/pyyaml"
         },
         "b3ddbcf": {
             "path": "./mozterm"
         },
+        "bddbd22": {
+            "path": "./../third_party/python/voluptuous"
+        },
         "c2c21d9": {
             "path": "./../third_party/python/py"
         },
         "c49d32a": {
             "markers": "python_version < '3.3'",
             "path": "./../third_party/python/mock-1.0.0"
         },
         "c6b7cc8": {
@@ -101,16 +119,19 @@
             "path": "./../third_party/python/six"
         },
         "d5b4a14": {
             "path": "./mach"
         },
         "d88f467": {
             "path": "./../testing/mozbase/mozprofile"
         },
+        "dcaaf6a": {
+            "path": "./../third_party/python/json-e"
+        },
         "e09e103": {
             "path": "./../testing/mozbase/moznetwork"
         },
         "f1d74ca": {
             "path": "./../testing/mozbase/mozversion"
         },
         "f1de77a": {
             "markers": "python_version < '3.3'",
new file mode 100644
--- /dev/null
+++ b/taskcluster/setup.py
@@ -0,0 +1,37 @@
+# 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 __future__ import absolute_import
+
+from setuptools import setup
+
+setup(
+    author='Mozilla Foundation',
+    author_email='dev-builds@lists.mozilla.org',
+    name='taskgraph',
+    description='Terminal abstractions built around the blessings module.',
+    license='MPL 2.0',
+    install_requires=[
+        'attrs>=18.1.0',
+        'requests-unixsocket>=0.1.5'
+        'voluptuous>=0.10.5',
+    ],
+    packages=[
+        'taskgraph',
+        'taskgraph.actions',
+        'taskgraph.cron',
+        'taskgraph.transforms',
+        'taskgraph.transforms.job',
+        'taskgraph.util',
+    ],
+    version='1.0.0',
+    classifiers=[
+        'Development Status :: 3 - Alpha',
+        'Topic :: Software Development :: Build Tools',
+        'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: Implementation :: CPython',
+    ],
+    keywords='mozilla build taskcluster taskgraph',
+)
--- a/taskcluster/taskgraph/__init__.py
+++ b/taskcluster/taskgraph/__init__.py
@@ -1,18 +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 __future__ import absolute_import, print_function, unicode_literals
 
 import os
 
-GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..'))
+from mozbuild.base import MozbuildObject
 
+config = MozbuildObject.from_environment()
+
+GECKO = config.topsrcdir
 APP_VERSION_PATH = os.path.join(GECKO, "browser", "config", "version.txt")
 VERSION_PATH = os.path.join(GECKO, "browser", "config", "version_display.txt")
 
 # Maximum number of dependencies a single task can have
 # https://docs.taskcluster.net/reference/platform/taskcluster-queue/references/api#createTask
 # specifies 100, but we also optionally add the decision task id as a dep in
 # taskgraph.create, so let's set this to 99.
 MAX_DEPENDENCIES = 99
--- a/taskcluster/taskgraph/morph.py
+++ b/taskcluster/taskgraph/morph.py
@@ -20,21 +20,22 @@ from __future__ import absolute_import, 
 
 import logging
 import os
 import re
 
 import jsone
 import yaml
 from slugid import nice as slugid
+from . import GECKO
 from .task import Task
 from .graph import Graph
 from .taskgraph import TaskGraph
 
-here = os.path.abspath(os.path.dirname(__file__))
+
 logger = logging.getLogger(__name__)
 MAX_ROUTES = 10
 
 
 def amend_taskgraph(taskgraph, label_to_taskid, to_add):
     """Add the given tasks to the taskgraph, returning a new taskgraph"""
     new_tasks = taskgraph.tasks.copy()
     new_edges = taskgraph.graph.edges.copy()
@@ -160,17 +161,17 @@ def add_index_tasks(taskgraph, label_to_
 
 
 class apply_jsone_templates(object):
     """Apply a set of JSON-e templates to each task's `task` attribute.
 
     :param templates: A dict with the template name as the key, and extra context
                       to use (in addition to task.to_json()) as the value.
     """
-    template_dir = os.path.join(here, 'templates')
+    template_dir = os.path.join(GECKO, 'taskcluster', 'taskgraph', 'templates')
 
     def __init__(self, try_task_config):
         self.templates = try_task_config.get('templates')
         self.target_tasks = try_task_config.get('tasks')
 
     def __call__(self, taskgraph, label_to_taskid):
         if not self.templates:
             return taskgraph, label_to_taskid
deleted file mode 100644
--- a/taskcluster/taskgraph/test/test_util_python_path.py
+++ b/taskcluster/taskgraph/test/test_util_python_path.py
@@ -18,20 +18,20 @@ class TestPythonPath(unittest.TestCase):
 
     def test_find_object_no_such_module(self):
         """find_object raises ImportError for a nonexistent module"""
         self.assertRaises(ImportError, python_path.find_object, "no_such_module:someobj")
 
     def test_find_object_no_such_object(self):
         """find_object raises AttributeError for a nonexistent object"""
         self.assertRaises(AttributeError, python_path.find_object,
-                          "taskgraph.test.test_util_python_path:NoSuchObject")
+                          "test_util_python_path:NoSuchObject")
 
     def test_find_object_exists(self):
         """find_object finds an existing object"""
-        from taskgraph.test.test_util_python_path import TestObject
+        from test_util_python_path import TestObject
         obj = python_path.find_object(
-            "taskgraph.test.test_util_python_path:TestObject.testClassProperty")
+            "test_util_python_path:TestObject.testClassProperty")
         self.assertIs(obj, TestObject.testClassProperty)
 
 
 if __name__ == '__main__':
     main()