microsoft / microsoft/azure-devops-python-api

Failed to call method "create_test_run" in azure python api

未關閉
#520 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Python
星號
684
分支
218
平均合併
8 天 10 小時
30 天內合併 PR
1

描述

Hi, i have a problem wih azure's python api. I self written function in python which calls official api from microscoft.

def create_test_run(self,
                        a_project_name: str = None,
                        a_comment: str = None,
                        a_test_run_name: str = None,
                        a_error_msg: str = None,
                        a_test_run_points=None,
                        a_test_plan=None
                        ) -> TestRun:
        """create_test_run
        :param str a_project_name: the name of the azure project where your test_plans are located
        :param str a_comment: a comment that shall be added to the newly created test run
        :param str a_test_run_name: the name of the test_run that shall be created
        :param str a_error_msg: an error message for this test_run that can be displayed in azure
        :param str a_test_run_points: a list of point_ids that reference azure TestPlan <-> TestSuite <-> TestCase relation
        :param :class:`ShallowReference <azure.devops.v5_1.microsoft._team_foundation._test_management._web_api.models.ShallowReference>` a_test_plan: the test_plan for which this test_run shall be created
        :rtype: :class:`<TestRun> <azure.devops.v5_1.test_results.models.TestRun>`
        """
        if None in (a_project_name, a_test_run_name, a_test_run_points, a_test_plan):
            raise InputError(
                f"cannot create test_run in azure with a_project_name={a_project_name}, a_test_run_name={a_test_run_name}, a_test_run_points={a_test_run_points}, a_test_plan={a_test_plan}")

self. LOGGER.debug(
            f"[create_test_run] creating create_test_run[{a_test_run_name}]")

test_run = RunCreateModel(automated=False,
                                  comment=a_comment,
                                  name=a_test_run_name,
                                  error_message=a_error_msg,
                                  plan=a_test_plan,
                                  point_ids=a_test_run_points
                                  # build=builds.value[0]            #TODO: check if we can add a build :class:`ShallowReference <azure.devops.v5_1.microsoft._team_foundation._test_management._web_api.models.ShallowReference>`
                                  )
        return self.connection.clients_v5_1.get_test_results_client().create_test_run(test_run=test_run, project=a_project_name)

Every time we send this request, it gives a 404 error back, that the ressource does not exist. After looking carefully into the microscofts python api carefully i saw something. The function create_test_run in https://github.com/microsoft/azure-devops-python-api/blob/dev/azure-devops/azure/devops/v7_1/test_results/test_results_client.py only exists in the branches with a version number like dev5.1 and dev7.1. In the branch which is called dev, this function exists in another location which is https://github.com/microsoft/azure-devops-python-api/blob/dev/azure-devops/azure/devops/v7_1/test/test_client.py and the location ids are not identical. I would be very grateful if you can take a closer look to these source files.

Thank you and best regards,

Daniel

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

比較 azure/devops/v7_1/test_results/test_results_client.py 和 azure/devops/v7_1/test/test_client.py 中提到的 create_test_run 實作,重點關注它們的 location ID 和用戶端方法。使用所示的 RunCreateModel 引數重現請求,並判定它為何回傳 404;識別出正確的操作並釐清用戶端行為或用法後,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
azure, python
領域
api
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。