Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Update documentation to contain start time of test instead of end time

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

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
38/100
Issue 類型
文件
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
html, python

研究方向

從描述時間欄的使用者文件部分開始,並將其與 issue 中顯示的 pytest hooks 和 HTML 儲存格進行比較。檢查 setup、call 和 teardown 階段是如何表示的,然後更新文件,讓預期的 timestamp 行為明確,並驗證範例仍然準確。

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

描述

I added a time column as explained in the user documentation but this adds the end timestamp.
The following seems to achieve more what I want. Some feedback would be great and maybe it is worth updating the documentation?

import pytest
from datetime import datetime


def pytest_html_results_table_header(cells):
    cells.insert(2, '<th class="sortable time" data-column-type="time">Time</th>')


def pytest_html_results_table_row(report, cells):
    start = datetime.fromtimestamp(report.start)
    cells.insert(2, f'<td class="col-time">{start}</td>')


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
    outcome = yield
    report = outcome.get_result()
    report.start = call.start

I am still a bit unsure about the different phases of a test like setup, call and teardown. Maybe this needs extra handling?

主要語言
Python
星號
779
分支
260
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

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

pytest-dev/pytest-html 的其他 Issue

查看 pytest-dev/pytest-html 的全部 Issue

相似的 Issue

更多 Python Issue

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

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