@@ -148,9 +148,9 @@ def callback(
148148 )
149149
150150 if not fixture .exists ():
151- if name == "demo-0.1.0.tar.gz" :
152- fixture = fixture_dir ( "distributions" ) / "demo-0.1.0.tar.gz"
153- else :
151+ fixture = fixture_dir ( "distributions" ) / name
152+
153+ if not fixture . exists () :
154154 fixture = (
155155 fixture_dir ("distributions" ) / "demo-0.1.0-py2.py3-none-any.whl"
156156 )
@@ -337,6 +337,66 @@ def test_execute_prints_warning_for_yanked_package(
337337 assert error .count ("yanked" ) == 0
338338
339339
340+ def test_execute_prints_warning_for_invalid_wheels (
341+ config : Config ,
342+ pool : RepositoryPool ,
343+ io : BufferedIO ,
344+ tmp_dir : str ,
345+ mock_file_downloads : None ,
346+ env : MockEnv ,
347+ ):
348+ config .merge ({"cache-dir" : tmp_dir })
349+
350+ executor = Executor (env , pool , config , io )
351+
352+ base_url = "https://files.pythonhosted.org/"
353+ wheel1 = "demo_invalid_record-0.1.0-py2.py3-none-any.whl"
354+ wheel2 = "demo_invalid_record2-0.1.0-py2.py3-none-any.whl"
355+ return_code = executor .execute (
356+ [
357+ Install (
358+ Package (
359+ "demo-invalid-record" ,
360+ "0.1.0" ,
361+ source_type = "url" ,
362+ source_url = f"{ base_url } /{ wheel1 } " ,
363+ )
364+ ),
365+ Install (
366+ Package (
367+ "demo-invalid-record2" ,
368+ "0.1.0" ,
369+ source_type = "url" ,
370+ source_url = f"{ base_url } /{ wheel2 } " ,
371+ )
372+ ),
373+ ]
374+ )
375+
376+ warning1 = f"""\
377+ <warning>Warning: Validation of the RECORD file of { wheel1 } failed.\
378+ Please report to the maintainers of that package so they can fix their build process.\
379+ Details:
380+ In .*?{ wheel1 } , demo/__init__.py is not mentioned in RECORD
381+ In .*?{ wheel1 } , demo_invalid_record-0.1.0.dist-info/WHEEL is not mentioned in RECORD
382+ """
383+
384+ warning2 = f"""\
385+ <warning>Warning: Validation of the RECORD file of { wheel2 } failed.\
386+ Please report to the maintainers of that package so they can fix their build process.\
387+ Details:
388+ In .*?{ wheel2 } , hash / size of demo_invalid_record2-0.1.0.dist-info/METADATA didn't\
389+ match RECORD
390+ """
391+
392+ output = io .fetch_output ()
393+ error = io .fetch_error ()
394+ assert return_code == 0 , f"\n output: { output } \n error: { error } \n "
395+ assert re .match (f"{ warning1 } \n { warning2 } " , error ) or re .match (
396+ f"{ warning2 } \n { warning1 } " , error
397+ ), error
398+
399+
340400def test_execute_shows_skipped_operations_if_verbose (
341401 config : Config ,
342402 pool : RepositoryPool ,
0 commit comments