2
2
import logging
3
3
import sys
4
4
from subprocess import CalledProcessError
5
+ from typing import List
5
6
6
7
import pytest
7
8
from pytest import LogCaptureFixture , MonkeyPatch
@@ -91,7 +92,7 @@ def test_ensure_snow_installed_binary(monkeypatch: MonkeyPatch, caplog: LogCaptu
91
92
monkeypatch .setattr ("builtins.__import__" , mock_failed_import )
92
93
93
94
# Mock run to return success
94
- def mock_run (cmd : list [str ], ** kwargs ):
95
+ def mock_run (cmd : List [str ], ** kwargs ):
95
96
assert cmd == ["snow" , "--version" ]
96
97
assert kwargs .get ("capture_output" ) is True
97
98
assert kwargs .get ("check" ) is True
@@ -116,7 +117,7 @@ def test_ensure_snow_installed_nobinary(monkeypatch: MonkeyPatch, caplog: LogCap
116
117
monkeypatch .setattr ("builtins.__import__" , mock_failed_import )
117
118
118
119
# Mock run to raise FileNotFoundError
119
- def mock_run (cmd : list [str ], ** kwargs ):
120
+ def mock_run (cmd : List [str ], ** kwargs ):
120
121
if cmd == ["snow" , "--version" ]:
121
122
raise FileNotFoundError ("No such file or directory: 'snow'" )
122
123
return MockRunResult (returncode = 0 )
@@ -142,7 +143,7 @@ def test_ensure_snow_installed_failing_binary(monkeypatch: MonkeyPatch, caplog:
142
143
monkeypatch .setattr ("builtins.__import__" , mock_failed_import )
143
144
144
145
# Mock run to raise CalledProcessError
145
- def mock_run (cmd : list [str ], ** kwargs ):
146
+ def mock_run (cmd : List [str ], ** kwargs ):
146
147
if cmd == ["snow" , "--version" ]:
147
148
raise CalledProcessError (returncode = 1 , cmd = cmd , output = "" , stderr = "Command failed with exit code 1" )
148
149
return MockRunResult (returncode = 0 )
0 commit comments