当前位置: 首页>>代码示例>>Python>>正文


Python commit_parser.parse_commit函数代码示例

本文整理汇总了Python中taskcluster_graph.commit_parser.parse_commit函数的典型用法代码示例。如果您正苦于以下问题:Python parse_commit函数的具体用法?Python parse_commit怎么用?Python parse_commit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parse_commit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_commit_no_tests

    def test_commit_no_tests(self):
        '''
        This test covers the case of builds but no tests passed -u none
        '''
        commit = 'try: -b o -p linux -u none -t none'
        jobs = {
            'flags': {
                'builds': ['linux', 'linux64'],
                'tests': ['web-platform-tests'],
            },
            'builds': {
                'linux': {
                    'types': {
                        'opt': {
                            'task': 'task/linux',
                         },
                        'debug': {
                            'task': 'task/linux-debug'
                        }
                    }
                },
            },
            'tests': {}
        }

        expected = [
            {
                'task': 'task/linux',
                'dependents': [],
                'additional-parameters': {}
            }
        ]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:35,代码来源:test_commit_parser.py

示例2: test_specific_chunks

    def test_specific_chunks(self):
        """
        This test covers specifying specific chunks for a given test suite.
        """
        commit = "try: -b o -p linux -u mochitest-1,mochitest-2 -t none"
        jobs = {
            "flags": {"builds": ["linux"], "tests": ["mochitest"]},
            "builds": {"linux": {"types": {"opt": {"task": "task/linux"}, "debug": {"task": "task/linux-debug"}}}},
            "tests": {"mochitest": {"allowed_build_tasks": {"task/linux": {"task": "task/mochitest", "chunks": 5}}}},
        }

        expected = [
            {
                "task": "task/linux",
                "dependents": [
                    {
                        "allowed_build_tasks": {
                            "task/linux": {"task": "task/mochitest", "chunks": 5, "only_chunks": set([1, 2])}
                        }
                    }
                ],
                "additional-parameters": {},
            }
        ]
        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:DINKIN,项目名称:Waterfox,代码行数:26,代码来源:test_commit_parser.py

示例3: test_flag_aliasing

    def test_flag_aliasing(self):
        commit = 'try: -b o -p magic-alias -u none -t none'
        jobs = {
            'flags': {
                'aliases': {
                    'magic-alias': 'linux'
                },
                'builds': ['linux', 'linux64'],
                'tests': ['web-platform-tests'],
            },
            'builds': {
                'linux': {
                    'types': {
                        'opt': {
                            'task': 'task/linux',
                         },
                        'debug': {
                            'task': 'task/linux-debug'
                        }
                    }
                },
            },
            'tests': {}
        }

        expected = [
            {
                'task': 'task/linux',
                'dependents': [],
                'additional-parameters': {}
            }
        ]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:35,代码来源:test_commit_parser.py

示例4: test_specific_chunks

    def test_specific_chunks(self):
        '''
        This test covers specifying specific chunks for a given test suite.
        '''
        commit = 'try: -b o -p linux -u mochitest-1,mochitest-2 -t none'
        jobs = {
            'flags': {
                'builds': ['linux'],
                'tests': ['mochitest'],
            },
            'builds': {
                'linux': {
                    'types': {
                        'opt': {
                            'task': 'task/linux',
                         },
                        'debug': {
                            'task': 'task/linux-debug'
                        }
                    }
                },
            },
            'tests': {
                'mochitest': {
                    'allowed_build_tasks': {
                        'task/linux': {
                            'task': 'task/mochitest',
                            'chunks': 5
                        },
                    }
                }
            }
        }

        expected = [
            {
                'task': 'task/linux',
                'dependents': [
                    {
                        'allowed_build_tasks': {
                            'task/linux': {
                                'task': 'task/mochitest',
                                'chunks': 5,
                                'only_chunks': set([1, 2])
                            },
                        }
                    }
                ],
                'additional-parameters': {},
                'post-build': [],
                'build_name': 'linux',
                'build_type': 'opt',
                'interactive': False,
            }
        ]
        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:Jesson-Wang,项目名称:gecko,代码行数:57,代码来源:test_commit_parser.py

示例5: test_some_test_tasks_restricted

    def test_some_test_tasks_restricted(self):
        '''
        This test covers the case of all builds but no tests passed -u none
        '''
        commit = 'try: -b do -p all -u all -t none'
        jobs = {
            'flags': {
                'builds': ['linux', 'linux64'],
                'tests': ['web-platform-tests'],
            },
            'builds': {
                'linux': {
                    'types': {
                        'opt': {
                            'task': 'task/linux',
                         },
                        'debug': {
                            'task': 'task/linux-debug'
                        }
                    }
                },
            },
            'tests': {
                'web-platform-tests': {
                    'allowed_build_tasks': {
                        'task/linux': {
                            'task': 'task/web-platform-tests',
                        }
                    }
                }
            }
        }

        expected = [
            {
                'task': 'task/linux-debug',
                'dependents': [],
                'additional-parameters': {}
            },
            {
                'task': 'task/linux',
                'dependents': [{
                    'allowed_build_tasks': {
                        'task/linux': {
                            'task':'task/web-platform-tests'
                        }
                    }
                }],
                'additional-parameters': {}
            }
        ]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:54,代码来源:test_commit_parser.py

示例6: test_specific_test_platforms

    def test_specific_test_platforms(self):
        """
        This test cases covers the platform specific test exclusion options.
        Intentionally includes platforms with spaces.
        """
        commit = "try: -b od -p all -u all[Windows XP,b2g] -t none"
        jobs = {
            "flags": {"builds": ["linux", "win32"], "tests": ["web-platform-tests", "mochitest"]},
            "builds": {
                "linux": {"types": {"opt": {"task": "task/linux"}, "debug": {"task": "task/linux-debug"}}},
                "win32": {"platforms": ["Windows XP"], "types": {"opt": {"task": "task/win32"}}},
            },
            "tests": {
                "web-platform-tests": {
                    "allowed_build_tasks": {
                        "task/linux": {"task": "task/web-platform-tests"},
                        "task/win32": {"task": "task/web-platform-tests"},
                    }
                },
                "mochitest": {
                    "allowed_build_tasks": {
                        "task/linux-debug": {"task": "task/mochitest"},
                        "task/win32": {"task": "task/mochitest"},
                    }
                },
            },
        }

        expected = [
            {"task": "task/linux", "dependents": [], "additional-parameters": {}},
            {"task": "task/linux-debug", "dependents": [], "additional-parameters": {}},
            {
                "task": "task/win32",
                "dependents": [
                    {
                        "allowed_build_tasks": {
                            "task/linux": {"task": "task/web-platform-tests"},
                            "task/win32": {"task": "task/web-platform-tests"},
                        }
                    },
                    {
                        "allowed_build_tasks": {
                            "task/linux-debug": {"task": "task/mochitest"},
                            "task/win32": {"task": "task/mochitest"},
                        }
                    },
                ],
                "additional-parameters": {},
            },
        ]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:DINKIN,项目名称:Waterfox,代码行数:53,代码来源:test_commit_parser.py

示例7: test_commit_all_builds_no_tests

    def test_commit_all_builds_no_tests(self):
        """
        This test covers the case of all builds but no tests passed -u none
        """
        commit = "try: -b o -p all -u none -t none"
        jobs = {
            "flags": {"builds": ["linux", "linux64"], "tests": ["web-platform-tests"]},
            "builds": {"linux": {"types": {"opt": {"task": "task/linux"}, "debug": {"task": "task/linux-debug"}}}},
            "tests": {},
        }

        expected = [{"task": "task/linux", "dependents": [], "additional-parameters": {}}]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:DINKIN,项目名称:Waterfox,代码行数:15,代码来源:test_commit_parser.py

示例8: test_flag_aliasing

    def test_flag_aliasing(self):
        commit = "try: -b o -p magic-alias -u none -t none"
        jobs = {
            "flags": {
                "aliases": {"magic-alias": "linux"},
                "builds": ["linux", "linux64"],
                "tests": ["web-platform-tests"],
            },
            "builds": {"linux": {"types": {"opt": {"task": "task/linux"}, "debug": {"task": "task/linux-debug"}}}},
            "tests": {},
        }

        expected = [{"task": "task/linux", "dependents": [], "additional-parameters": {}}]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:DINKIN,项目名称:Waterfox,代码行数:16,代码来源:test_commit_parser.py

示例9: test_try_flag_in_middle_of_commit

    def test_try_flag_in_middle_of_commit(self):
        """
        The try command prefix may appear anywhere this test ensures that it
        works in some common cases.
        """
        commit = "Bug XXX - I like cheese try: -b o -p all -u none wootbar"
        jobs = {
            "flags": {"builds": ["linux", "linux64"], "tests": ["web-platform-tests"]},
            "builds": {"linux": {"types": {"opt": {"task": "task/linux"}, "debug": {"task": "task/linux-debug"}}}},
            "tests": {},
        }

        expected = [{"task": "task/linux", "dependents": [], "additional-parameters": {}}]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:DINKIN,项目名称:Waterfox,代码行数:16,代码来源:test_commit_parser.py

示例10: test_try_flag_in_middle_of_commit

    def test_try_flag_in_middle_of_commit(self):
        '''
        The try command prefix may appear anywhere this test ensures that it
        works in some common cases.
        '''
        commit = 'Bug XXX - I like cheese try: -b o -p all -u none wootbar'
        jobs = {
            'flags': {
                'builds': ['linux', 'linux64'],
                'tests': ['web-platform-tests'],
            },
            'builds': {
                'linux': {
                    'types': {
                        'opt': {
                            'task': 'task/linux',
                         },
                        'debug': {
                            'task': 'task/linux-debug'
                        }
                    }
                },
            },
            'tests': {}
        }

        expected = [
            {
                'task': 'task/linux',
                'dependents': [],
                'additional-parameters': {},
                'build_name': 'linux',
                'build_type': 'opt',
                'interactive': False,
                'post-build': []
            }
        ]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:Jesson-Wang,项目名称:gecko,代码行数:40,代码来源:test_commit_parser.py

示例11: test_commit_with_builds_and_tests

    def test_commit_with_builds_and_tests(self):
        """
        This test covers the broad case of a commit which has both builds and
        tests without any exclusions or other fancy logic.
        """
        commit = "try: -b od -p linux,linux64 -u web-platform-tests -t none"
        jobs = {
            "flags": {"builds": ["linux", "linux64"], "tests": ["web-platform-tests"]},
            "builds": {
                "linux": {"types": {"opt": {"task": "task/linux"}, "debug": {"task": "task/linux-debug"}}},
                "linux64": {"types": {"opt": {"task": "task/linux64"}, "debug": {"task": "task/linux64-debug"}}},
            },
            "tests": {
                "web-platform-tests": {
                    "allowed_build_tasks": {
                        "task/linux": {"task": "task/web-platform-tests"},
                        "task/linux-debug": {"task": "task/web-platform-tests"},
                        "task/linux64": {"task": "task/web-platform-tests"},
                        "task/linux64-debug": {"task": "task/web-platform-tests"},
                    }
                }
            },
        }

        expected = [
            {
                "task": "task/linux",
                "dependents": [
                    {
                        "allowed_build_tasks": {
                            "task/linux": {"task": "task/web-platform-tests"},
                            "task/linux-debug": {"task": "task/web-platform-tests"},
                            "task/linux64": {"task": "task/web-platform-tests"},
                            "task/linux64-debug": {"task": "task/web-platform-tests"},
                        }
                    }
                ],
                "additional-parameters": {},
            },
            {
                "task": "task/linux-debug",
                "dependents": [
                    {
                        "allowed_build_tasks": {
                            "task/linux": {"task": "task/web-platform-tests"},
                            "task/linux-debug": {"task": "task/web-platform-tests"},
                            "task/linux64": {"task": "task/web-platform-tests"},
                            "task/linux64-debug": {"task": "task/web-platform-tests"},
                        }
                    }
                ],
                "additional-parameters": {},
            },
            {
                "task": "task/linux64",
                "dependents": [
                    {
                        "allowed_build_tasks": {
                            "task/linux": {"task": "task/web-platform-tests"},
                            "task/linux-debug": {"task": "task/web-platform-tests"},
                            "task/linux64": {"task": "task/web-platform-tests"},
                            "task/linux64-debug": {"task": "task/web-platform-tests"},
                        }
                    }
                ],
                "additional-parameters": {},
            },
            {
                "task": "task/linux64-debug",
                "dependents": [
                    {
                        "allowed_build_tasks": {
                            "task/linux": {"task": "task/web-platform-tests"},
                            "task/linux-debug": {"task": "task/web-platform-tests"},
                            "task/linux64": {"task": "task/web-platform-tests"},
                            "task/linux64-debug": {"task": "task/web-platform-tests"},
                        }
                    }
                ],
                "additional-parameters": {},
            },
        ]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:DINKIN,项目名称:Waterfox,代码行数:85,代码来源:test_commit_parser.py

示例12: test_invalid_commit

 def test_invalid_commit(self):
     '''
     Disallow invalid commit messages from being parsed...
     '''
     with self.assertRaises(InvalidCommitException):
         parse_commit("wootbarbaz", {})
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:6,代码来源:test_commit_parser.py

示例13: test_commit_with_builds_and_tests


#.........这里部分代码省略.........
                            'task': 'task/web-platform-tests',
                        }
                    }
                }
            }
        }

        expected = [
            {
                'task': 'task/linux',
                'dependents': [
                    {
                        'allowed_build_tasks': {
                            'task/linux': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux-debug': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux64': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux64-debug': {
                                'task': 'task/web-platform-tests',
                            }
                        }
                    }
                ],
                'additional-parameters': {}
            },
            {
                'task': 'task/linux-debug',
                'dependents': [
                    {
                        'allowed_build_tasks': {
                            'task/linux': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux-debug': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux64': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux64-debug': {
                                'task': 'task/web-platform-tests',
                            }
                        }
                    }
                ],
                'additional-parameters': {}
            },
            {
                'task': 'task/linux64',
                'dependents': [
                    {
                        'allowed_build_tasks': {
                            'task/linux': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux-debug': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux64': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux64-debug': {
                                'task': 'task/web-platform-tests',
                            }
                        }
                    }
                ],
                'additional-parameters': {}
            },
            {
                'task': 'task/linux64-debug',
                'dependents': [
                    {
                        'allowed_build_tasks': {
                            'task/linux': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux-debug': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux64': {
                                'task': 'task/web-platform-tests',
                            },
                            'task/linux64-debug': {
                                'task': 'task/web-platform-tests',
                            }
                        }
                    }
                ],
                'additional-parameters': {}
            }
        ]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:101,代码来源:test_commit_parser.py

示例14: test_specific_test_platforms_with_specific_platform

    def test_specific_test_platforms_with_specific_platform(self):
        '''
        This test cases covers the platform specific test exclusion options.
        '''
        commit = 'try: -b od -p win32 -u mochitest[windows] -t none'
        jobs = {
            'flags': {
                'builds': ['linux', 'win32'],
                'tests': ['web-platform-tests', 'mochitest'],
            },
            'builds': {
                'linux': {
                    'types': {
                        'opt': {
                            'task': 'task/linux'
                        },
                        'debug': {
                            'task': 'task/linux-debug'
                        }
                    }
                },
                'win32': {
                    'platforms': ['windows'],
                    'types': {
                        'opt': {
                            'task': 'task/win32'
                        }
                    }
                },
            },
            'tests': {
                'web-platform-tests': {
                    'allowed_build_tasks': {
                        'task/linux': {
                            'task': 'task/web-platform-tests',
                        },
                        'task/win32': {
                            'task': 'task/web-platform-tests',
                        }
                    }
                },
                'mochitest': {
                    'allowed_build_tasks': {
                        'task/linux-debug': {
                            'task': 'task/mochitest',
                        },
                        'task/win32': {
                            'task': 'task/mochitest',
                        }
                    }
                }
            }
        }

        expected = [
            {
                'task': 'task/win32',
                'dependents': [
                    {
                        'allowed_build_tasks': {
                            'task/linux-debug': {
                                'task': 'task/mochitest',
                            },
                            'task/win32': {
                                'task': 'task/mochitest',
                            }
                        }
                    }
                ],
                'additional-parameters': {}
            }
        ]

        result = parse_commit(commit, jobs)
        self.assertEqual(expected, result)
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:75,代码来源:test_commit_parser.py

示例15: create_graph

    def create_graph(self, **params):
        from taskcluster_graph.commit_parser import parse_commit
        from slugid import nice as slugid
        from taskcluster_graph.from_now import json_time_from_now, current_json_time
        from taskcluster_graph.templates import Templates
        import taskcluster_graph.build_task

        project = params["project"]
        message = params.get("message", "") if project == "try" else DEFAULT_TRY

        # Message would only be blank when not created from decision task
        if project == "try" and not message:
            sys.stderr.write(
                "Must supply commit message when creating try graph. " "Example: --message='try: -b do -p all -u all'"
            )
            sys.exit(1)

        templates = Templates(ROOT)
        job_path = os.path.join(ROOT, "tasks", "branches", project, "job_flags.yml")
        job_path = job_path if os.path.exists(job_path) else DEFAULT_JOB_PATH

        jobs = templates.load(job_path, {})

        job_graph = parse_commit(message, jobs)

        cmdline_interactive = params.get("interactive", False)

        # Template parameters used when expanding the graph
        parameters = dict(
            gaia_info().items()
            + {
                "index": "index",
                "project": project,
                "pushlog_id": params.get("pushlog_id", 0),
                "docker_image": docker_image,
                "base_repository": params["base_repository"] or params["head_repository"],
                "head_repository": params["head_repository"],
                "head_ref": params["head_ref"] or params["head_rev"],
                "head_rev": params["head_rev"],
                "owner": params["owner"],
                "from_now": json_time_from_now,
                "now": current_json_time(),
                "revision_hash": params["revision_hash"],
            }.items()
        )

        treeherder_route = "{}.{}".format(params["project"], params.get("revision_hash", ""))

        routes_file = os.path.join(ROOT, "routes.json")
        with open(routes_file) as f:
            contents = json.load(f)
            json_routes = contents["routes"]
            # TODO: Nightly and/or l10n routes

        # Task graph we are generating for taskcluster...
        graph = {"tasks": [], "scopes": []}

        if params["revision_hash"]:
            for env in TREEHERDER_ROUTES:
                graph["scopes"].append("queue:route:{}.{}".format(TREEHERDER_ROUTES[env], treeherder_route))

        graph["metadata"] = {
            "source": "http://todo.com/what/goes/here",
            "owner": params["owner"],
            # TODO: Add full mach commands to this example?
            "description": "Task graph generated via ./mach taskcluster-graph",
            "name": "task graph local",
        }

        all_routes = {}

        for build in job_graph:
            interactive = cmdline_interactive or build["interactive"]
            build_parameters = dict(parameters)
            build_parameters["build_slugid"] = slugid()
            build_task = templates.load(build["task"], build_parameters)
            set_interactive_task(build_task, interactive)

            # try builds don't use cache
            if project == "try":
                remove_caches_from_task(build_task)

            if params["revision_hash"]:
                decorate_task_treeherder_routes(build_task["task"], treeherder_route)
                decorate_task_json_routes(build, build_task["task"], json_routes, build_parameters)

            # Ensure each build graph is valid after construction.
            taskcluster_graph.build_task.validate(build_task)
            graph["tasks"].append(build_task)

            test_packages_url, tests_url, mozharness_url = None, None, None

            if "test_packages" in build_task["task"]["extra"]["locations"]:
                test_packages_url = ARTIFACT_URL.format(
                    build_parameters["build_slugid"], build_task["task"]["extra"]["locations"]["test_packages"]
                )

            if "tests" in build_task["task"]["extra"]["locations"]:
                tests_url = ARTIFACT_URL.format(
                    build_parameters["build_slugid"], build_task["task"]["extra"]["locations"]["tests"]
#.........这里部分代码省略.........
开发者ID:npark-mozilla,项目名称:gecko-dev,代码行数:101,代码来源:mach_commands.py


注:本文中的taskcluster_graph.commit_parser.parse_commit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。