@@ -282,10 +282,10 @@ def test_parse_metadata_prefer_pkg_info_from_egg_info_from_command_line(self):
282282 # `celery/celery.egg-info/PKG-INFO`
283283 vc = VirtualCodebase (location = result_file )
284284 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'
286286 for pkg in vc .attributes .packages :
287287 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'
289289
290290
291291class TestPipRequirementsFileHandler (PackageTester ):
@@ -417,47 +417,23 @@ def test_parse_dependency_file_with_invalid_does_not_fail(self):
417417 expected_loc = self .get_test_loc ('pypi/requirements_txt/invalid_spec/output.expected.json' )
418418 self .check_packages_data (package , expected_loc , regen = REGEN_TEST_FIXTURES )
419419
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 (self , filename ):
436+ assert pypi .PipRequirementsFileHandler .is_datafile (filename , _bare_filename = True )
461437
462438
463439class TestPyPiPipfile (PackageTester ):
@@ -607,36 +583,36 @@ def check_setup_py_parsing(test_loc):
607583
608584 expected_loc2 = f'{ test_loc } -expected.json'
609585 packages_data = pypi .PythonSetupPyHandler .parse (test_loc )
610- test_envt .check_packages_data (
586+ env .check_packages_data (
611587 packages_data = packages_data ,
612588 expected_loc = expected_loc2 ,
613589 regen = REGEN_TEST_FIXTURES ,
614590 must_exist = False ,
615591 )
616592
617593
618- test_envt = PackageTester ()
594+ env = PackageTester ()
619595
620596
621597@pytest .mark .parametrize (
622598 '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' ))),
624600)
625601def test_parse_setup_py_with_computed_versions (test_loc ):
626602 check_setup_py_parsing (test_loc )
627603
628604
629605@pytest .mark .parametrize (
630606 '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' )))
632608)
633609def test_parse_setup_py (test_loc ):
634610 check_setup_py_parsing (test_loc )
635611
636612
637613@pytest .mark .parametrize (
638614 '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' ))),
640616)
641617def test_parse_more_setup_py (test_loc ):
642618 check_setup_py_parsing (test_loc )
0 commit comments