Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run coverage checks with python3 #4245

Merged
merged 2 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .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
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}."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might was well go all-in on the f-strings.

)
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