@@ -82,13 +82,16 @@ def test_conditional_dependencies(self, metadata):
82
82
assert d .extras == ['baz' ]
83
83
84
84
def test_invalid_version (self , tmp_path ):
85
+ """
86
+ Supplying an invalid version crashes dist_info.
87
+ """
85
88
config = "[metadata]\n name=proj\n version=42\n [egg_info]\n tag_build=invalid!!!\n "
86
89
(tmp_path / "setup.cfg" ).write_text (config , encoding = "utf-8" )
87
90
msg = re .compile ("invalid version" , re .M | re .I )
88
- output = run_command ("dist_info" , cwd = tmp_path )
89
- assert msg . search ( output )
90
- dist_info = next ( tmp_path . glob ( "*.dist-info" ) )
91
- assert dist_info . name . startswith ( "proj-42" )
91
+ proc = run_command_inner ("dist_info" , cwd = tmp_path , check = False )
92
+ assert proc . returncode
93
+ assert msg . search ( proc . stdout )
94
+ assert not list ( tmp_path . glob ( "*.dist-info" ) )
92
95
93
96
def test_tag_arguments (self , tmp_path ):
94
97
config = """
@@ -190,7 +193,17 @@ def test_dist_info_is_the_same_as_in_wheel(
190
193
assert read (dist_info / file ) == read (wheel_dist_info / file )
191
194
192
195
193
- def run_command (* cmd , ** kwargs ):
194
- opts = {"stderr" : subprocess .STDOUT , "text" : True , ** kwargs }
196
+ def run_command_inner (* cmd , ** kwargs ):
197
+ opts = {
198
+ "stderr" : subprocess .STDOUT ,
199
+ "stdout" : subprocess .PIPE ,
200
+ "text" : True ,
201
+ 'check' : True ,
202
+ ** kwargs ,
203
+ }
195
204
cmd = [sys .executable , "-c" , "__import__('setuptools').setup()" , * map (str , cmd )]
196
- return subprocess .check_output (cmd , ** opts )
205
+ return subprocess .run (cmd , ** opts )
206
+
207
+
208
+ def run_command (* args , ** kwargs ):
209
+ return run_command_inner (* args , ** kwargs ).stdout
0 commit comments