Skip to content

Commit

Permalink
Migrate presubmit.py to python3
Browse files Browse the repository at this point in the history
Running the unit tests, I noticed a failing test.
test_event_name_hash was never updated when
cros:: was changed to chrome::. Now it passes
for both py2 and 3.

Bug: 1212109
Change-Id: I13aa6a72e9b666b9683018ff6b3fa2515c02948e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2934183
Commit-Queue: Dan H <[email protected]>
Reviewed-by: Weilun Shi <[email protected]>
Cr-Commit-Position: refs/heads/master@{#890294}
  • Loading branch information
Dan Harrington authored and Chromium LUCI CQ committed Jun 8, 2021
1 parent 3e3f497 commit c3374ba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tools/metrics/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ group("metrics_python_tests") {
"//tools/metrics/histograms/pretty_print.py",
"//tools/metrics/histograms/pretty_print_test.py",

"//tools/metrics/structured/codegen_unittest.py",
"//tools/metrics/structured/model_unittest.py",

"//tools/metrics/ukm/ukm.xml",
"//tools/metrics/ukm/codegen.py",
"//tools/metrics/ukm/codegen_test.py",
Expand Down
2 changes: 2 additions & 0 deletions tools/metrics/structured/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
for more details on the presubmit API built into gcl.
"""

USE_PYTHON3 = True

STRUCTURED_XML = 'structured.xml'
STRUCTURED_OLD_XML = 'structured.old.xml'

Expand Down
4 changes: 2 additions & 2 deletions tools/metrics/structured/codegen_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def test_hash_name(self):
def test_event_name_hash(self):
# This was generated using the function in Chromium's
# //base/metrics/metrics_hashes.cc for the string
# cros::TestProjectOne::TestEventOne
event_name_hash = 16542188217976373364
# chrome::TestProjectOne::TestEventOne
event_name_hash = 13593049295042080097
project_name = 'TestProjectOne'
event_name = 'TestEventOne'
self.assertEqual(Util.event_name_hash(project_name, event_name),
Expand Down

0 comments on commit c3374ba

Please sign in to comment.