def test_explicit_package_dir() -> None: metadata = Metadata(FIXTURES / "projects/demo-explicit-package-dir/pyproject.toml") paths = metadata.convert_package_paths() assert paths["packages"] == ["my_package"] assert paths["py_modules"] == [] assert paths["package_dir"] == {"": "foo"}
def test_parse_pep420_namespace_package() -> None: metadata = Metadata(FIXTURES / "projects/demo-pep420-package/pyproject.toml") paths = metadata.convert_package_paths() assert paths["package_dir"] == {} assert paths["packages"] == ["foo.my_package"] assert paths["py_modules"] == []
def test_parse_src_package_by_include(): metadata = Metadata(FIXTURES / "projects/demo-src-package-include/pyproject.toml") paths = metadata.convert_package_paths() assert paths["package_dir"] == {} assert paths["packages"] == ["sub.my_package"] assert paths["py_modules"] == []
def test_package_with_old_include() -> None: metadata = Metadata(FIXTURES / "projects/demo-package-include-old/pyproject.toml") paths = metadata.convert_package_paths() assert paths["py_modules"] == [] assert paths["packages"] == ["my_package"] assert paths["package_dir"] == {} assert paths["package_data"] == {"": ["*"]} assert not metadata.classifiers
def test_parse_module() -> None: metadata = Metadata(FIXTURES / "projects/demo-module/pyproject.toml") assert metadata.name == "demo-module" assert metadata.version == "0.1.0" assert metadata.author == "" assert metadata.author_email == "frostming <*****@*****.**>" paths = metadata.convert_package_paths() assert sorted(paths["py_modules"]) == ["bar_module", "foo_module"] assert paths["packages"] == [] assert paths["package_dir"] == {}
def test_parse_src_package() -> None: metadata = Metadata(FIXTURES / "projects/demo-src-package/pyproject.toml") paths = metadata.convert_package_paths() assert paths["packages"] == ["my_package"] assert paths["py_modules"] == [] assert paths["package_dir"] == {"": "src"}
def test_parse_error_package() -> None: metadata = Metadata(FIXTURES / "projects/demo-package-include-error/pyproject.toml") with pytest.raises(ValueError): metadata.convert_package_paths()
def test_src_dir_containing_modules() -> None: metadata = Metadata(FIXTURES / "projects/demo-src-pymodule/pyproject.toml") paths = metadata.convert_package_paths() assert paths["package_dir"] == {"": "src"} assert not paths["packages"] assert paths["py_modules"] == ["foo_module"]