[英]Python: How to run tests made with unittest
要從命令行運行 unittest,您應該使用以下命令:
python -m unittest tests.test_hotel
您需要確保遵循編寫單元測試的規則( https://docs.python.org/2/library/unittest.html )
正如@shahram kalantari 所說,要運行測試,命令行是:
python -m unittest tests.test_hotel
如果想運行整個測試,命令行是:
python -m unittest discover tests
如果您想了解有關運行哪些測試的更多信息,應包含-v
標志:
python -m unittest discover tests -v
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.