@@ -282,10 +282,10 @@ def test_parse_metadata_prefer_pkg_info_from_egg_info_from_command_line(self):
282
282
# `celery/celery.egg-info/PKG-INFO`
283
283
vc = VirtualCodebase (location = result_file )
284
284
for dep in vc .attributes .dependencies :
285
- self . assertEqual ( dep ['datafile_path' ], 'celery/celery.egg-info/PKG-INFO' )
285
+ assert dep ['datafile_path' ] == 'celery/celery.egg-info/PKG-INFO'
286
286
for pkg in vc .attributes .packages :
287
287
for path in pkg ['datafile_paths' ]:
288
- self . assertEqual ( path , 'celery/celery.egg-info/PKG-INFO' )
288
+ assert path == 'celery/celery.egg-info/PKG-INFO'
289
289
290
290
291
291
class TestPipRequirementsFileHandler (PackageTester ):
@@ -417,47 +417,23 @@ def test_parse_dependency_file_with_invalid_does_not_fail(self):
417
417
expected_loc = self .get_test_loc ('pypi/requirements_txt/invalid_spec/output.expected.json' )
418
418
self .check_packages_data (package , expected_loc , regen = REGEN_TEST_FIXTURES )
419
419
420
- def test_PipRequirementsFileHandler_is_datafile (self ):
421
- self .assertEqual (
422
- pypi .PipRequirementsFileHandler .is_datafile ('dev-requirements.txt' , _bare_filename = True ),
423
- True
424
- )
425
- self .assertEqual (
426
- pypi .PipRequirementsFileHandler .is_datafile ('requirements.txt' , _bare_filename = True ),
427
- True
428
- )
429
- self .assertEqual (
430
- pypi .PipRequirementsFileHandler .is_datafile ('requirement.txt' , _bare_filename = True ),
431
- True
432
- )
433
- self .assertEqual (
434
- pypi .PipRequirementsFileHandler .is_datafile ('requirements.in' , _bare_filename = True ),
435
- True
436
- )
437
- self .assertEqual (
438
- pypi .PipRequirementsFileHandler .is_datafile ('requirements.pip' , _bare_filename = True ),
439
- True
440
- )
441
- self .assertEqual (
442
- pypi .PipRequirementsFileHandler .is_datafile ('requirements-dev.txt' , _bare_filename = True ),
443
- True
444
- )
445
- self .assertEqual (
446
- pypi .PipRequirementsFileHandler .is_datafile ('some-requirements-dev.txt' , _bare_filename = True ),
447
- True
448
- )
449
- self .assertEqual (
450
- pypi .PipRequirementsFileHandler .is_datafile ('requires.txt' , _bare_filename = True ),
451
- True
452
- )
453
- self .assertEqual (
454
- pypi .PipRequirementsFileHandler .is_datafile ('requirements/base.txt' , _bare_filename = True ),
455
- True
456
- )
457
- self .assertEqual (
458
- pypi .PipRequirementsFileHandler .is_datafile ('reqs.txt' , _bare_filename = True ),
459
- True
460
- )
420
+ @pytest .mark .parametrize (
421
+ 'filename' ,
422
+ [
423
+ 'dev-requirements.txt' ,
424
+ 'reqs.txt' ,
425
+ 'requirements/base.txt' ,
426
+ 'requirements-dev.txt' ,
427
+ 'requirements.in' ,
428
+ 'requirements.pip' ,
429
+ 'requirements.txt' ,
430
+ 'requirement.txt' ,
431
+ 'requires.txt' ,
432
+ 'some-requirements-dev.txt' ,
433
+ ]
434
+ )
435
+ def test_PipRequirementsFileHandler_is_datafile (filename ):
436
+ assert pypi .PipRequirementsFileHandler .is_datafile (location = filename , _bare_filename = True )
461
437
462
438
463
439
class TestPyPiPipfile (PackageTester ):
@@ -607,36 +583,36 @@ def check_setup_py_parsing(test_loc):
607
583
608
584
expected_loc2 = f'{ test_loc } -expected.json'
609
585
packages_data = pypi .PythonSetupPyHandler .parse (test_loc )
610
- test_envt .check_packages_data (
586
+ env .check_packages_data (
611
587
packages_data = packages_data ,
612
588
expected_loc = expected_loc2 ,
613
589
regen = REGEN_TEST_FIXTURES ,
614
590
must_exist = False ,
615
591
)
616
592
617
593
618
- test_envt = PackageTester ()
594
+ env = PackageTester ()
619
595
620
596
621
597
@pytest .mark .parametrize (
622
598
'test_loc' ,
623
- get_setup_py_test_files (os .path .abspath (os .path .join (test_envt .test_data_dir , 'pypi' , 'setup.py-versions' ))),
599
+ get_setup_py_test_files (os .path .abspath (os .path .join (env .test_data_dir , 'pypi' , 'setup.py-versions' ))),
624
600
)
625
601
def test_parse_setup_py_with_computed_versions (test_loc ):
626
602
check_setup_py_parsing (test_loc )
627
603
628
604
629
605
@pytest .mark .parametrize (
630
606
'test_loc' ,
631
- get_setup_py_test_files (os .path .abspath (os .path .join (test_envt .test_data_dir , 'pypi' , 'setup.py' )))
607
+ get_setup_py_test_files (os .path .abspath (os .path .join (env .test_data_dir , 'pypi' , 'setup.py' )))
632
608
)
633
609
def test_parse_setup_py (test_loc ):
634
610
check_setup_py_parsing (test_loc )
635
611
636
612
637
613
@pytest .mark .parametrize (
638
614
'test_loc' ,
639
- get_setup_py_test_files (os .path .abspath (os .path .join (test_envt .test_data_dir , 'pypi' , 'more_setup.py' ))),
615
+ get_setup_py_test_files (os .path .abspath (os .path .join (env .test_data_dir , 'pypi' , 'more_setup.py' ))),
640
616
)
641
617
def test_parse_more_setup_py (test_loc ):
642
618
check_setup_py_parsing (test_loc )
0 commit comments