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

tests: test infrastructure (setup/teardown) improvements

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

維護者通常 10 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
重構
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
python
領域
testing-qa

研究方向

先閱讀 Modified_Testcase 與 #1346 中關於測試基礎設施的討論,以整理現有的 setup 和 teardown 模式。比較測試如何建立、提供服務、公開和移除 repository 與暫存目錄。當共用方法能涵蓋類別層級和執行個體層級的 repository,且不需要重複或不可靠的清理時,即代表完成。

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

描述

enhancement testing

(Documenting test improvement ideas from #1346)

A lot (most?) of our tests require a test server (or several). This typically means moving metadata from sources to a temp directory, serving the temp directory and finally removing the temporary directories. Modified_Testcase handles parts of that but it seems obvious that A) it does not provide the required functionality (as tests re-implement a lot of it) and B) that it is hard to use correctly (as #1346 and many previous issues prove). The end result is that there are temp directories created inside tempdirectories and then those directories may or may not get removed (often in a fairly random order)

The common needs are these I think:

  • Test class must be able to serve a repository that all its tests run against
  • test instance must be able to serve it's own repository (because it wants to modify the contents)
  • the served repository paths must be exposed so the content can be modified during test

We could have a better Modified_Testcase that just always runs one test server per class, and provides helpers to "intitialize a new repo" (copy files from sources into a directory inside the served directory). This way both server startup/shutdown and tempdir management would be handled in one place: the actual test classes would only have to remember to chain up Setup*() and *Teardown() -- if they even need those when Modified_Testcase is better.

主要語言
Python
星號
1.7k
分支
304
平均合併
9 小時 25 分鐘
30 天內合併 PR
14

環境準備

從這裡開始

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

theupdateframework/python-tuf 的其他 Issue

查看 theupdateframework/python-tuf 的全部 Issue

相似的 Issue

更多 Python Issue

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

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