2017-01-23 13 views
0

문제 : 플라스크 응용 프로그램이 Pybuilder을 제거하기 위해 빌드하는 동안 run.py을 제외 범위를 필요로 건설되고 커버리지 비율에 메시지 영향을 경고igrore run.py 모듈로 (pybuilder에 포함 된) 적용 범위를 업데이트하는 방법은 무엇입니까?

[WARN] Module 'run' was not imported by the covered tests 

[WARN] Test coverage below 70% for run: 0% 

에서

(env3)$ python3 build.py 
PyBuilder version 0.11.9 
Build started at 2017-01-23 12:48:03 
------------------------------------------------------------ 
[INFO] Building myproject version 0.0.1.00526 
[INFO] Executing build in /Users/zzzz/Documents/Projects/myproject 
[INFO] Going to execute tasks: clean, install_dependencies, analyze, publish 
[INFO] Removing target directory /Users/zzzz/Documents/Projects/myproject/target 
[INFO] Installing all dependencies 
[INFO] Running unit tests 
[INFO] Executing unit tests from Python modules in /Users/zzzz/Documents/Projects/myproject/src/unittest/python 
[INFO] Executed 14 unit tests 
[INFO] All unit tests passed. 
[INFO] Executing flake8 on project sources. 
[INFO] Collecting coverage information 
[WARN] coverage_branch_threshold_warn is 0 and branch coverage will not be checked 
[WARN] coverage_branch_partial_threshold_warn is 0 and partial branch coverage will not be checked 
[INFO] Running unit tests 
[INFO] Executing unit tests from Python modules in /Users/zzzz/Documents/Projects/myproject/src/unittest/python 
[INFO] Executed 14 unit tests 
[INFO] All unit tests passed. 
[WARN] Module 'run' was not imported by the covered tests 
------------------------------------------------------------ 
BUILD FAILED - Build aborted 
------------------------------------------------------------ 
Build finished at 2017-01-23 12:48:16 
Build took 12 seconds (12694 ms) 
[WARN] Test coverage below 70% for run: 0% 
[WARN] Test coverage below 70% for run: 0% 
[WARN] Test coverage below 70% for app.mod_upload: 21% 
[WARN] Test coverage below 70% for app.mod_upload: 21% 
[INFO] Overall coverage is 79% 
[INFO] Overall coverage branch coverage is 66% 
[INFO] Overall coverage partial branch coverage is 77% 
[INFO] Overall coverage is 79% 
[INFO] Overall coverage branch coverage is 66% 
[INFO] Overall coverage partial branch coverage is 77% 
(env3)$ 

질문 : 나는 answer here을 사용할 수 있었지만, 명령 행에서 혼자가 아니라, pybuild에 의해 실행 된 커버리지를 사용할 수 있습니다. 그래서 --omit solution은 문제를 일으키는 아주 적절하지 않습니다. 누군가 조언 해 줄 수 있습니까?

+0

즉 경고 pybuilder 내지 ([여기 (https://github.com/pybuilder/pybuilder/blob/3bb52943e4e78dc316525f6facd2231bc956f5c1/src/main/python/pybuilder/plugins/python/coverage_plugin.py#L165))이므로 일반적인 coverage.py 대답은 아마도 도움이되지 않습니다. –

답변

0

답변을 찾았습니다! 해결 방법 : build.py에서 (pybuilder 프로젝트의 일부) 추가 : 필요에 따라

@init 
def set_properties(project): 
    project.set_property("coverage_exceptions", ['run',]) 

목록은 다른 모듈로 확장 할 수있다.