Skip to content

Commit

Permalink
Don't depend on current working directory in test
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlstrom-g committed Aug 2, 2023
1 parent a94345b commit 171dc2d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/metrics/ukm/gen_builders_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@
from decode_template import IMPL as DECODE_IMPL_TEMPLATE
import ukm_model
import gen_builders
import os

_FILE_DIR = os.path.dirname(__file__)

class GenBuildersTest(unittest.TestCase):
def testFilterObsoleteMetrics(self):
data = gen_builders.ReadFilteredData('../../tools/metrics/ukm/ukm.xml')
data = gen_builders.ReadFilteredData(_FILE_DIR + '/ukm.xml')
for event in data[ukm_model._EVENT_TYPE.tag]:
self.assertTrue(ukm_model.IsNotObsolete(event))
for metric in event[ukm_model._METRIC_TYPE.tag]:
self.assertTrue(ukm_model.IsNotObsolete(metric))

def testGenerateCode(self):
relpath = '.'
with open('../../tools/metrics/ukm/ukm.xml') as f:
with open(_FILE_DIR + '/ukm.xml') as f:
data = ukm_model.UKM_XML_TYPE.Parse(f.read())
event = data[ukm_model._EVENT_TYPE.tag][0]
metric = event[ukm_model._METRIC_TYPE.tag][0]
Expand Down

0 comments on commit 171dc2d

Please sign in to comment.