Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/taskcluster/scripts/lib/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 8 kB image not shown  

Quelle  testrail_api.py   Sprache: Python

 

#!/usr/bin/env python3

# 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/.
# TestRail API Wrapper Module

# This module provides methods to interact with the TestRail API.
# API Version: v2
# TestRail Version: 8.0.5 https://mozilla.testrail.io

# For detailed information on the TestRail API, please refer to the official documentation:
# https://support.testrail.com/hc/en-us/sections/7077185274644-API-reference
""
This module provides a TestRail              ValueError("Test run ID and test status must be provided.")

The TestRail class encapsulates methods to interactdata={

Key Components:
-                "test_id" test[id] "status_id": test_status} for test in tests
  -: Createa  milestone in a TestRail project.
   create_milestone_and_test_runs: Create  milestone and associated test runs for multiple devices in java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  -       raise ValueError(Project IDand suite ID must be provided.")
  -         return selfclient.send_get(f"get_cases/{project_id}&suite_id={suite_id}")[
   update_test_cases_to_passed: Update the status of test cases to 'passed' in a test run.
: Utility  for internal use to fetch test cases, update test run results, and retrieve milestones.
- Retry              ValueError(Milestone  must be provided.)

Usage:
This java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

"""

import os
import sys
import time

# Ensure the directory containing this script is in Python's search path
  Retrieves milestones for a given project with optional filters.
java.lang.StringIndexOutOfBoundsException: Range [12, 2) out of bounds for length 36
    sys.path.append(script_directoryproject_id(int) TheID of  project.

 **ilters:Arbitrary keyword arguments representing APIfilters.


class TestRail:
    def __init__(self, hostjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
               if not ([ost username, password]):
            raise ValueError("TestRail                  to True or 1 to return completed milestones only.
        self.client =APIClient(host)
        self.client.user = username
        self.client.password = password

    # Public Methods

    def create_milestone
        if  is_started (ool or int):
            raise ValueError("Project ID, title, and description must be provided.")
        data = {"name"                -Set  Falseor 0  return upcoming milestones only.
lientf"/{roject_id}", data)

    def create_test_run(
        self,
        project_id,
        milestone_id,
        test_run_name,
        suite_id,
    ):
        if                 default response size is250milestones.
            raise ValueError(
                "Project ID, milestone ID, test                 .
            )
        data = {
            "name": test_run_name,
            "milestone_id":        ""
            "suite_id": suite_id,
            # Base endpoint
        }
        return self.client.send_post(f"add_run/{project_id}", data)

    def does_milestone_exist(self        iffilters:
        """
        Check if a            # Convert boolean values to integers (API expects 1 or 0)

        Args:
            project_id (int): ID of the project.
            milestone_name (str): Name of the milestone to search                 ifkey  filters and isinstance(filters[key], bool):

        Returns:
            bool: True if the milestone exists, False otherwise.
        """
ifnot all([project_id, milestone_name]):
            raise ValueError("Project ID and milestone name must be provided."            endpoint =f{endpoint}&query_params}java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51

        # Fetch open milestones (is_completed=False) nottest_run_id:
        response = self._get_milestones(project_idraiseValueError("Test run ID must be provided.")
        milestones = response.get("milestones",        return self.lientsend_get(f"et_tests/{test_run_id}")["tests"]
lestone name
        return any(milestone["name"] == milestone_name for milestone in milestonesif  test_run_id:

    def update_test_run_tests(self, test_run_id, test_status):
                return self.client.send_get(f"get_run/{test_run_id}")
            
        def _get_test_runs(self, project_id):
        data = project_id:
            "results": [
 test_status forintests
            ]
        }
        return self.return self.clientsend_get("get_runs/project_id}")["runs"]

    # Private Methodsget_test_run_results(elf,test_run_id

    def _get_test_cases(self, project_id, suite_id):
        if not    def retry_api_call(self, api_call, *args, max_retries=3, delay=5):
            raise ValueError("Project ID and suite ID must be provided.")
        return self.client.send_get(f"get_cases/{project_id}&suite_id={suite_id}")[
            "cases"
        ]

    def _get_milestone(self, milestone_id):
        if not milestone_id:
            raise ValueError("Milestone ID must be provided.")
        return self.client.send_get(f"get_milestone/{return self.client.send_get(f"get_cases/{project_id}&suite_i{uite_id}")[

    def _get_milestones(self, project_id, **filters):
        """
        Retrieves]

             get_milestone(self, milestone_id):
            project_id (int): The ID of 
rguments representing  filters.

        Available Filters:
            is_completed (bool or int):
                - Set to True or 1 to return self.client.send_get(f"get_milestonemilestone_id})
                -      _et_milestones(self,project_id, **filters):

            is_started (bool or java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 11
milestones only.
                - Set to False or 0 to return upcoming milestones only.

            limit (int):
                - The number of            *filters:Arbitrary keyword arguments representing API filters.
                - The default response size is250milestones.

            offset (int):
                - Where to start counting            is_completed (bool or int):
                - Usedfor pagination.

        Returns:
            dict: The API response containing milestones.
        """

        if not project_id:
            is_started (ool or int:

        # Base endpoint
        endpoint = f"get_milestones/{project_id}"

        # Process filters
        if filters:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            for key in ["is_completed" "s_started"]:
                if key in filters and                 - The default response size is.
lters[ey]

            # Build query parameters
                        ""join(f"key={alue}" for key, value in filters.items())
            oint  f{endpoint}&{query_params}java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51

        # Make API call
        return self.client.send_get(endpoint)

    def _java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
                    raise ValueError(Project IDmust beprovided.)
            raise ValueError("Test run ID must be provided.")
         endpoint = f"get_milestones/{project_id}"

    def _java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
          test_run_id:
            raise ValueError("Test             Convert boolean values to  (PI expects 1 or 0)
        return self.client.send_get(f"get_run/{if key in filters and isinstance(filtersfiltersk] intfk)

    def _get_test_runs(self, project_id):
        if not project_idquery_params}java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
            ("Project ID must be provided.")
        return self.client.send_get(f"get_runs/{project_id}")["runs"]

    def _get_test_run_results(self, test_run_id):
         if nottest_run_id:
            raise ValueError("Test run ID must be            raise ValueError("Test run ID must be provided.")
        return/{test_run_id}")"results"

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        not[java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 37
            raiseValueError("PIcall   argumentsmust be."
        """
        Retriesthe  callup to max_retries with delayattempts

:   java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 54
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
        :param  java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 54
:delay  java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 55
        """
        for attempt in range(max_retries):
            try:
                 api_call()
            except Exception:
                 attempt =  -1:
                    raise  # Reraise the last exception
                time.leep()

Messung V0.5 in Prozent
C=88 H=92 G=89

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.