Skip to content

Commit

Permalink
Run coverage checks with python3 (#4245)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Elion authored Jul 17, 2020
1 parent 3901bad commit 536fbaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .yamato/com.unity.ml-agents-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test_{{ package.name }}_{{ platform.name }}_{{ editor.version }}:

{% 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:
Expand Down Expand Up @@ -110,7 +110,7 @@ test_{{ package.name }}_{{ platform.name }}_trunk:
- 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:
Expand Down
10 changes: 2 additions & 8 deletions ml-agents/tests/yamato/check_coverage_percent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

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
Expand All @@ -30,16 +28,12 @@ def check_coverage(root_dir, min_percentage):
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}."
)
sys.exit(1)
else:
print(
"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)

Expand Down

0 comments on commit 536fbaf

Please sign in to comment.