Fix Python 3 compatibility issues

This commit is contained in:
Roland Dobai
2018-10-10 13:19:31 +02:00
parent 7c29a39d6f
commit 9daf51e6be
12 changed files with 40 additions and 36 deletions
+3 -3
View File
@@ -68,7 +68,7 @@ class Parser(object):
table = CreateSectionTable.SectionTable("section_table.tmp")
tags = self.parse_tags(os.path.join(config_output_folder, self.SDKCONFIG_FILE))
test_cases = []
with open("case_address.tmp", "r") as f:
with open("case_address.tmp", "rb") as f:
for line in f:
# process symbol table like: "3ffb4310 l O .dram0.data 00000018 test_desc_33$5010"
line = line.split()
@@ -235,7 +235,7 @@ class Parser(object):
dump parsed test cases to YAML file for test bench input
:param test_cases: parsed test cases
"""
with open(os.path.join(self.idf_path, self.TEST_CASE_FILE), "wb+") as f:
with open(os.path.join(self.idf_path, self.TEST_CASE_FILE), "w+") as f:
yaml.dump({"test cases": test_cases}, f, allow_unicode=True, default_flow_style=False)
def copy_module_def_file(self):
@@ -297,7 +297,7 @@ def test_parser():
}
sdkconfig = ["123", "789"]
tags = parser.parse_tags_internal(sdkconfig, config_dependency, parser.CONFIG_PATTERN)
assert tags == ['a', 'd', 'f']
assert sorted(tags) == ['a', 'd', 'f'] # sorted is required for older Python3, e.g. 3.4.8
def main():