def test_pydist_check_files(): test_files = ( ('', 'METADATA', '1'), ('', 'RECORD', '2'), ('', 'INSTALLER', '3'), ) # Test mandatory files found temp_path, fpaths = _create_test_files(test_files) PythonInstalledDistribution(temp_path, "2.7", None) # Test mandatory file not found os.remove(fpaths[0]) with pytest.raises(AssertionError): PythonInstalledDistribution(temp_path, "2.7", None)
def test_python_dist_info(): test_files = ( ('', 'METADATA', ('Name: zoom\n' 'Requires-Python: ==2.7\n' 'Requires-External: C\n')), ('', 'RECORD', 'foo/bar,sha256=1,"45"\nfoo/spam,,\n'), ('', 'INSTALLER', ''), ) # Test mandatory files found temp_path, fpaths = _create_test_files(test_files) dist = PythonInstalledDistribution(temp_path, "RECORD", "2.7") paths = dist.get_paths() _print_output(paths) assert len(paths) == 2 assert dist.get_python_requirements() == frozenset(['==2.7']) assert dist.get_external_requirements() == frozenset(['C'])
def test_python_dist_info(): test_files = ( ('', 'METADATA', ('Name: zoom\n' 'Requires-Python: ==2.7\n' 'Requires-External: C\n' ) ), ('', 'RECORD', 'foo/bar,sha256=1,"45"\nfoo/spam,,\n'), ('', 'INSTALLER', ''), ) # Test mandatory files found temp_path, fpaths = _create_test_files(test_files) dist = PythonInstalledDistribution(temp_path, "RECORD", "2.7") paths = dist.get_paths() _print_output(paths) assert len(paths) == 2 assert dist.get_python_requirements() == frozenset(['==2.7']) assert dist.get_external_requirements() == frozenset(['C'])