Skip to content

Commit 674a95a

Browse files
authored
[test] Use read_file/read_binary helpers. NFC (#25726)
1 parent 8f354ae commit 674a95a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,16 @@
107107
# If we are drawing a parallel swimlane graph of test output, we need to use a temp
108108
# file to track which tests were flaky so they can be graphed in orange color to
109109
# visually stand out.
110-
flaky_tests_log_filename = os.path.join(path_from_root('out/flaky_tests.txt'))
111-
browser_spawn_lock_filename = os.path.join(path_from_root('out/browser_spawn_lock'))
110+
flaky_tests_log_filename = path_from_root('out/flaky_tests.txt')
111+
browser_spawn_lock_filename = path_from_root('out/browser_spawn_lock')
112112

113113

114114
@memoize
115115
def get_safari_version():
116116
if not is_safari():
117117
return UNSUPPORTED
118118
plist_path = os.path.join(EMTEST_BROWSER.strip(), 'Contents', 'version.plist')
119-
version_str = plistlib.load(open(plist_path, 'rb')).get('CFBundleShortVersionString')
119+
version_str = plistlib.load(read_binary(plist_path)).get('CFBundleShortVersionString')
120120
# Split into parts (major.minor.patch)
121121
parts = (version_str.split('.') + ['0', '0', '0'])[:3]
122122
# Convert each part into integers, discarding any trailing string, e.g. '13a' -> 13.
@@ -132,7 +132,7 @@ def get_firefox_version():
132132
exe_path = shlex.split(EMTEST_BROWSER)[0]
133133
ini_path = os.path.join(os.path.dirname(exe_path), "platform.ini")
134134
# Extract the first numeric part before any dot (e.g. "Milestone=102.15.1" → 102)
135-
m = re.search(r"^Milestone=(.*)$", open(ini_path).read(), re.MULTILINE)
135+
m = re.search(r"^Milestone=(.*)$", read_file(ini_path), re.MULTILINE)
136136
milestone = m.group(1).strip()
137137
version = int(re.match(r"(\d+)", milestone).group(1))
138138
# On Nightly and Beta, e.g. 145.0a1, pretend it to still mean version 144,

0 commit comments

Comments
 (0)