def test_injection_distutils_compiler_gsw(): recipe = PyPi(name="gsw", version="3.3.1") data = recipe._get_sdist_metadata( "https://pypi.io/packages/source/g/gsw/gsw-3.3.1.tar.gz", "gsw" ) assert data.get("compilers") == ["c"] assert data["packages"] == ["gsw"]
def test_merge_pypi_sdist_metadata(): recipe = PyPi(name="gsw", version="3.3.1") pypi_metadata = recipe._get_pypi_metadata(name="gsw", version="3.3.1") sdist_metadata = recipe._get_sdist_metadata(pypi_metadata["sdist_url"], "gsw") merged_data = PyPi._merge_pypi_sdist_metadata(pypi_metadata, sdist_metadata) assert merged_data["compilers"] == ["c"] assert sorted(merged_data["setup_requires"]) == sorted(["numpy"])
def test_injection_distutils_setup_reqs_ensure_list(): pkg_name, pkg_ver = "pyinstaller-hooks-contrib", "2020.7" recipe = PyPi(name=pkg_name, version=pkg_ver) data = recipe._get_sdist_metadata( f"https://pypi.io/packages/source/p/{pkg_name}/{pkg_name}-{pkg_ver}.tar.gz", pkg_name, ) assert data.get("setup_requires") == ["setuptools >= 30.3.0"]
def test_injection_distutils(): data = PyPi._get_sdist_metadata( "https://pypi.io/packages/source/h/hypothesis/hypothesis-5.5.1.tar.gz", "hypothesis", ) assert sorted(data["install_requires"]) == sorted( ["attrs>=19.2.0", "sortedcontainers>=2.1.0,<3.0.0"]) assert data["entry_points"] == { "pytest11": ["hypothesispytest = hypothesis.extra.pytestplugin"] } assert data["version"] == "5.5.1" assert data["name"] == "hypothesis" assert not data.get("compilers")
def test_injection_distutils_pytest(): data = PyPi._get_sdist_metadata( "https://pypi.io/packages/source/p/pytest/pytest-5.3.2.tar.gz", "pytest") assert sorted(data["install_requires"]) == sorted([ "py>=1.5.0", "packaging", "attrs>=17.4.0", "more-itertools>=4.0.0", 'atomicwrites>=1.0;sys_platform=="win32"', 'pathlib2>=2.2.0;python_version<"3.6"', 'colorama;sys_platform=="win32"', "pluggy>=0.12,<1.0", 'importlib-metadata>=0.12;python_version<"3.8"', "wcwidth", ]) assert sorted(data["setup_requires"]) == sorted( ["setuptools>=40.0", "setuptools_scm"]) assert not data.get("compilers")