@@ -99,6 +99,53 @@ def test_should_use_ephemeral_cache__issue_6197(
99
99
assert ephem_cache is expected
100
100
101
101
102
+ def test_format_command__INFO (caplog ):
103
+
104
+ caplog .set_level (logging .INFO )
105
+ actual = wheel .format_command (
106
+ command_args = ['arg1' , 'arg2' ],
107
+ command_output = 'output line 1\n output line 2\n ' ,
108
+ )
109
+ assert actual .splitlines () == [
110
+ "Command arguments: ['arg1', 'arg2']" ,
111
+ 'Command output: [use --verbose to show]' ,
112
+ ]
113
+
114
+
115
+ @pytest .mark .parametrize ('command_output' , [
116
+ # Test trailing newline.
117
+ 'output line 1\n output line 2\n ' ,
118
+ # Test no trailing newline.
119
+ 'output line 1\n output line 2' ,
120
+ ])
121
+ def test_format_command__DEBUG (caplog , command_output ):
122
+ caplog .set_level (logging .DEBUG )
123
+ actual = wheel .format_command (
124
+ command_args = ['arg1' , 'arg2' ],
125
+ command_output = command_output ,
126
+ )
127
+ assert actual .splitlines () == [
128
+ "Command arguments: ['arg1', 'arg2']" ,
129
+ 'Command output:' ,
130
+ 'output line 1' ,
131
+ 'output line 2' ,
132
+ '-----------------------------------------' ,
133
+ ]
134
+
135
+
136
+ @pytest .mark .parametrize ('log_level' , ['DEBUG' , 'INFO' ])
137
+ def test_format_command__empty_output (caplog , log_level ):
138
+ caplog .set_level (log_level )
139
+ actual = wheel .format_command (
140
+ command_args = ['arg1' , 'arg2' ],
141
+ command_output = '' ,
142
+ )
143
+ assert actual .splitlines () == [
144
+ "Command arguments: ['arg1', 'arg2']" ,
145
+ 'Command output: None' ,
146
+ ]
147
+
148
+
102
149
def call_get_legacy_build_wheel_path (caplog , names ):
103
150
req = make_test_install_req ()
104
151
wheel_path = wheel .get_legacy_build_wheel_path (
@@ -122,13 +169,11 @@ def test_get_legacy_build_wheel_path__no_names(caplog):
122
169
assert actual is None
123
170
assert len (caplog .records ) == 1
124
171
record = caplog .records [0 ]
125
- assert record .levelname == 'ERROR '
172
+ assert record .levelname == 'WARNING '
126
173
assert record .message .splitlines () == [
127
- "Failed building wheel for pendulum with args: ['arg1', 'arg2']" ,
128
- "Command output:" ,
129
- "output line 1" ,
130
- "output line 2" ,
131
- "-----------------------------------------" ,
174
+ "Legacy build of wheel for 'pendulum' created no files." ,
175
+ "Command arguments: ['arg1', 'arg2']" ,
176
+ 'Command output: [use --verbose to show]' ,
132
177
]
133
178
134
179
@@ -142,13 +187,10 @@ def test_get_legacy_build_wheel_path__multiple_names(caplog):
142
187
record = caplog .records [0 ]
143
188
assert record .levelname == 'WARNING'
144
189
assert record .message .splitlines () == [
145
- ("Found more than one file after building wheel for pendulum "
146
- "with args: ['arg1', 'arg2']" ),
147
- "Names: ['name1', 'name2']" ,
148
- "Command output:" ,
149
- "output line 1" ,
150
- "output line 2" ,
151
- "-----------------------------------------" ,
190
+ "Legacy build of wheel for 'pendulum' created more than one file." ,
191
+ "Filenames (choosing first): ['name1', 'name2']" ,
192
+ "Command arguments: ['arg1', 'arg2']" ,
193
+ 'Command output: [use --verbose to show]' ,
152
194
]
153
195
154
196
0 commit comments