Skip to content

Commit 7894374

Browse files
P-R-O-C-H-Yhfudev
andauthored
Apply suggestions from code review
Co-authored-by: Fu Hanxi <hfudev@gmail.com>
1 parent 66536c2 commit 7894374

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

pytest-embedded-wokwi/pytest_embedded_wokwi/wokwi_cli.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,21 @@ def __init__(
5757

5858
# first need to check if wokwi-cli exists in PATH
5959
if shutil.which('wokwi-cli') is None:
60-
print('Please install wokwi-cli, by running: curl -L https://wokwi.com/ci/install.sh | sh')
61-
# self.install_wokwi() not implemented yet
60+
raise RuntimeError('Please install wokwi-cli, by running: curl -L https://wokwi.com/ci/install.sh | sh')
6261

6362
child = pexpect.spawn('wokwi-cli --help')
6463
try:
6564
child.expect(r'Wokwi CLI v(\d+\.\d+\.\d+)', timeout=1)
6665
wokwi_cli_version = child.match.group(1).decode('utf-8')
6766
except pexpect.TIMEOUT:
68-
raise RuntimeError('Failed to run wokwi-cli')
69-
70-
if Version(wokwi_cli_version) < Version(WOKWI_CLI_MINIMUM_VERSION):
71-
raise ValueError(
72-
f'Wokwi CLI version {wokwi_cli_version} is not supported. '
73-
f'Minimum version required: {WOKWI_CLI_MINIMUM_VERSION}. '
74-
f'To update Wokwi CLI run: curl -L https://wokwi.com/ci/install.sh | sh'
75-
)
67+
logging.warning('Failed to get wokwi-cli version, assume version requirements satisfied')
68+
else:
69+
if Version(wokwi_cli_version) < Version(WOKWI_CLI_MINIMUM_VERSION):
70+
raise ValueError(
71+
f'Wokwi CLI version {wokwi_cli_version} is not supported. '
72+
f'Minimum version required: {WOKWI_CLI_MINIMUM_VERSION}. '
73+
f'To update Wokwi CLI run: curl -L https://wokwi.com/ci/install.sh | sh'
74+
)
7675

7776
self.create_wokwi_toml()
7877

0 commit comments

Comments
 (0)