浏览代码

Run coverage checks with python3 (#4245)

/MLA-1734-demo-provider
GitHub 4 年前
当前提交
8b139814
共有 2 个文件被更改,包括 4 次插入10 次删除
  1. 4
      .yamato/com.unity.ml-agents-test.yml
  2. 10
      ml-agents/tests/yamato/check_coverage_percent.py

4
.yamato/com.unity.ml-agents-test.yml


{% if package.name == "com.unity.ml-agents" %}
# TODO get coverage tests running for extensions too
- python ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ editor.minCoveragePct }}
- python3 ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ editor.minCoveragePct }}
{% endif %}
artifacts:
logs:

- upm-ci project test -u {{ editor.version }} --project-path Project --package-filter {{ package.name }} {{ editor.coverageOptions }}
{% if package.name == "com.unity.ml-agents" %}
# TODO get coverage tests running for extensions too
- python ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ editor.minCoveragePct }}
- python3 ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ editor.minCoveragePct }}
{% endif %}
artifacts:
logs:

10
ml-agents/tests/yamato/check_coverage_percent.py


SUMMARY_XML_FILENAME = "Summary.xml"
# Note that this is python2 compatible, since that's currently what's installed on most CI images.
def check_coverage(root_dir, min_percentage):
# Walk the root directory looking for the summary file that

pct = float(pct)
if pct < min_percentage:
print(
"Coverage {} is below the min percentage of {}.".format(
pct, min_percentage
)
f"Coverage {pct} is below the min percentage of {min_percentage}."
"Coverage {} is above the min percentage of {}.".format(
pct, min_percentage
)
f"Coverage {pct} is above the min percentage of {min_percentage}."
)
sys.exit(0)

正在加载...
取消
保存