簡體   English   中英

Python代碼覆蓋率

[英]Python code coverage

coverage 3.4
Nose 1.1.2
Python 2.7.1

我有一個像下面這樣的python項目結構

root
   src #source directory
      company
          division
              pkg1
                  module1
                  module2
              pkg2
                  module1
                  module2
   test #All test files
       company
           division
              pkg1
                  test_module1
                  test_module2

當我運行python nose時,我使用以下代碼片段

#Run tests
#Add dependencies like cheetah, yaml, etc to the sys.path
if __name__ == "__main__":
    os.environ["NOSE_INCLUDE_EXE"] = "1"
    os.environ["NOSE_WITH_XUNIT"] = "1"
    os.environ["NOSE_WITH_COVERAGE"] = "1"
    os.environ["NOSE_COVER_PACKAGE"] = "company.division"
    nose.main()

我的期望是我得到了“company.division”下所有包的清晰簡潔的輸出,但是我從獵豹,yaml和他們的報道獲得了我根本不感興趣的文件。 設置NOSE_COVER_PACKAGE似乎沒有任何區別。 有人能告訴我我錯過了什么嗎?

OP報告升級到鼻子1.3和覆蓋率3.6修復了這個問題。

請參閱此錯誤修復以供參考: https//github.com/Bahus/nose/commit/ddb14f0228ca94ae33d9e67785dc06bf412603f2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM