@@ -39,31 +39,39 @@ def which(cmd, executable_search_paths):
39
39
40
40
def test_release_build_cargo_command (self ):
41
41
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
42
- action = RustCargoLambdaBuildAction ("source_dir" , {"cargo" : cargo }, BuildMode .RELEASE )
42
+ action = RustCargoLambdaBuildAction (
43
+ "source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , self .subprocess_cargo_lambda
44
+ )
43
45
self .assertEqual (
44
46
action .build_command (),
45
47
["path/to/cargo" , "lambda" , "build" , "--release" ],
46
48
)
47
49
48
50
def test_release_build_cargo_command_with_target (self ):
49
51
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
50
- action = RustCargoLambdaBuildAction ("source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , "arm64" )
52
+ action = RustCargoLambdaBuildAction (
53
+ "source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , self .subprocess_cargo_lambda , "arm64"
54
+ )
51
55
self .assertEqual (
52
56
action .build_command (),
53
57
["path/to/cargo" , "lambda" , "build" , "--release" , "--arm64" ],
54
58
)
55
59
56
60
def test_debug_build_cargo_command (self ):
57
61
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
58
- action = RustCargoLambdaBuildAction ("source_dir" , {"cargo" : cargo }, BuildMode .DEBUG )
62
+ action = RustCargoLambdaBuildAction (
63
+ "source_dir" , {"cargo" : cargo }, BuildMode .DEBUG , self .subprocess_cargo_lambda
64
+ )
59
65
self .assertEqual (
60
66
action .build_command (),
61
67
["path/to/cargo" , "lambda" , "build" ],
62
68
)
63
69
64
70
def test_debug_build_cargo_command_with_architecture (self ):
65
71
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
66
- action = RustCargoLambdaBuildAction ("source_dir" , {"cargo" : cargo }, BuildMode .DEBUG , "arm64" )
72
+ action = RustCargoLambdaBuildAction (
73
+ "source_dir" , {"cargo" : cargo }, BuildMode .DEBUG , self .subprocess_cargo_lambda , "arm64"
74
+ )
67
75
self .assertEqual (
68
76
action .build_command (),
69
77
["path/to/cargo" , "lambda" , "build" , "--arm64" ],
@@ -72,15 +80,19 @@ def test_debug_build_cargo_command_with_architecture(self):
72
80
def test_debug_build_cargo_command_with_flags (self ):
73
81
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
74
82
flags = ["--package" , "package-in-workspace" ]
75
- action = RustCargoLambdaBuildAction ("source_dir" , {"cargo" : cargo }, BuildMode .DEBUG , "arm64" , flags = flags )
83
+ action = RustCargoLambdaBuildAction (
84
+ "source_dir" , {"cargo" : cargo }, BuildMode .DEBUG , self .subprocess_cargo_lambda , "arm64" , flags = flags
85
+ )
76
86
self .assertEqual (
77
87
action .build_command (),
78
88
["path/to/cargo" , "lambda" , "build" , "--arm64" , "--package" , "package-in-workspace" ],
79
89
)
80
90
81
91
def test_debug_build_cargo_command_with_handler (self ):
82
92
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
83
- action = RustCargoLambdaBuildAction ("source_dir" , {"cargo" : cargo }, BuildMode .DEBUG , "arm64" , handler = "foo" )
93
+ action = RustCargoLambdaBuildAction (
94
+ "source_dir" , {"cargo" : cargo }, BuildMode .DEBUG , self .subprocess_cargo_lambda , "arm64" , handler = "foo"
95
+ )
84
96
self .assertEqual (
85
97
action .build_command (),
86
98
["path/to/cargo" , "lambda" , "build" , "--arm64" , "--bin" , "foo" ],
@@ -89,7 +101,7 @@ def test_debug_build_cargo_command_with_handler(self):
89
101
def test_execute_happy_path (self ):
90
102
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
91
103
action = RustCargoLambdaBuildAction (
92
- "source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , subprocess_cargo_lambda = self .subprocess_cargo_lambda
104
+ "source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , self .subprocess_cargo_lambda
93
105
)
94
106
action .execute ()
95
107
@@ -99,7 +111,7 @@ def test_execute_cargo_build_fail(self):
99
111
100
112
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
101
113
action = RustCargoLambdaBuildAction (
102
- "source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , subprocess_cargo_lambda = self .subprocess_cargo_lambda
114
+ "source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , self .subprocess_cargo_lambda
103
115
)
104
116
with self .assertRaises (ActionFailedError ) as err_assert :
105
117
action .execute ()
@@ -110,7 +122,7 @@ def test_execute_happy_with_logger(self):
110
122
with patch .object (LOG , "debug" ) as mock_warning :
111
123
cargo = BinaryPath (None , None , None , binary_path = "path/to/cargo" )
112
124
action = RustCargoLambdaBuildAction (
113
- "source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , subprocess_cargo_lambda = self .subprocess_cargo_lambda
125
+ "source_dir" , {"cargo" : cargo }, BuildMode .RELEASE , self .subprocess_cargo_lambda
114
126
)
115
127
out = action .execute ()
116
128
self .assertEqual (out , "out" )
0 commit comments