Skip to content

Commit b098195

Browse files
committed
fix: log error when fail to parce iOS Simulators
1 parent ba7a630 commit b098195

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

core/utils/device/simctl.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ def __run_simctl_command(command, wait=True, timeout=30):
1818
command = '{0} {1}'.format('xcrun simctl', command)
1919
return Run.command(cmd=command, wait=wait, timeout=timeout)
2020

21+
# noinspection PyBroadException
2122
@staticmethod
2223
def __get_simulators():
2324
logs = Simctl.__run_simctl_command(command='list --json devices', wait=False).log_file
2425
found = Wait.until(lambda: 'iPhone' in File.read(logs), timeout=30)
2526
if found:
2627
json_content = '{' + File.read(logs).split('{', 1)[-1]
27-
return json.loads(json_content)
28+
try:
29+
return json.loads(json_content)
30+
except ValueError:
31+
Log.error('Failed to parse json ' + os.linesep + json_content)
32+
return json.loads('{}')
2833
else:
2934
Log.error(File.read(logs))
3035
raise Exception('Failed to list iOS Devices!')

tests/code_sharing/ng_new_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def create_and_run(shared=True, sample=False, theme=True, style=None, prefix=Non
143143
if Settings.ENV != EnvironmentType.LIVE:
144144
App.update(app_name=SmokeTests.app_name)
145145

146-
# Run android (if webpack is availalbe -> use --bundle)
146+
# Run android (if webpack is available -> use --bundle)
147147
Tns.run(app_name=SmokeTests.app_name, platform=Platform.ANDROID, bundle=webpack)
148148
for text in app_data.texts:
149149
SmokeTests.emu.wait_for_text(text=text, timeout=30)
@@ -155,7 +155,7 @@ def create_and_run(shared=True, sample=False, theme=True, style=None, prefix=Non
155155
else:
156156
assert blue_pixels == 0, 'Default {N} theme is applied, but it should not.'
157157

158-
# Run ios (if webpack is availalbe -> use --bundle)
158+
# Run ios (if webpack is available -> use --bundle)
159159
if Settings.HOST_OS is OSType.OSX:
160160
Tns.run(app_name=SmokeTests.app_name, platform=Platform.IOS, bundle=webpack)
161161
for text in app_data.texts:

0 commit comments

Comments
 (0)