Пример #1
0
    def task_reliability_by_project(
        self,
        project_id: str,
        after_date: Optional[datetime] = None,
        before_date: Optional[datetime] = None,
        group_num_days: Optional[int] = None,
        requesters: Optional[Requester] = None,
        tasks: Optional[List[str]] = None,
        variants: Optional[List[str]] = None,
        distros: Optional[List[str]] = None,
        group_by: Optional[str] = None,
        sort: Optional[str] = None,
    ) -> List[TaskReliability]:
        """
        Get task reliability scores.

        :param project_id: Id of patch to query for.
        :param after_date: Collect stats after this date.
        :param before_date: Collect stats before this date, defaults to nothing.
        :param group_num_days: Aggregate statistics to this size.
        :param requesters: Filter by requesters (mainline, patch, trigger, or adhoc).
        :param tasks: Only include specified tasks.
        :param variants: Only include specified variants.
        :param distros: Only include specified distros.
        :param group_by: How to group results (test_task_variant, test_task, or test)
        :param sort: How to sort results (earliest or latest).
        :return: Patch queried for.
        """
        params: Dict[str, Any] = {}
        if after_date:
            params["after_date"] = format_evergreen_date(after_date)
        if before_date:
            params["before_date"] = format_evergreen_date(before_date)
        if group_num_days:
            params["group_num_days"] = group_num_days
        if requesters:
            params["requesters"] = requesters.stats_value()
        if tasks:
            params["tasks"] = tasks
        if variants:
            params["variants"] = variants
        if distros:
            params["distros"] = distros
        if group_by:
            params["group_by"] = group_by
        if sort:
            params["sort"] = sort

        url = self._create_url(f"/projects/{project_id}/task_reliability")
        task_reliability_scores = self._paginate(url, params)
        return [
            TaskReliability(task_reliability, self) for task_reliability in
            task_reliability_scores  # type: ignore[arg-type]
        ]
Пример #2
0
    def test_date_is_formatted(self):
        now = datetime.now()

        now_str = under_test.format_evergreen_date(now)

        assert isinstance(now_str, str)