def test_wheel_prerelease(): module_path = fixtures_dir / "prerelease" WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO()) whl = module_path / "dist" / "prerelease-0.1b1-py2.py3-none-any.whl" assert whl.exists()
def test_wheel_package(): module_path = fixtures_dir / "complete" WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO()) whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl" assert whl.exists() with zipfile.ZipFile(str(whl)) as z: assert "my_package/sub_pkg1/__init__.py" in z.namelist()
def test_wheel_package_pep_561_stub_only_includes_typed_marker(): root = fixtures_dir / "pep_561_stub_only_partial" WheelBuilder.make(Factory().create_poetry(root), NullEnv(), NullIO()) whl = root / "dist" / "pep_561_stubs-0.1-py3-none-any.whl" assert whl.exists() with zipfile.ZipFile(str(whl)) as z: assert "pkg-stubs/py.typed" in z.namelist()
def test_wheel_module(): module_path = fixtures_dir / "module1" WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO()) whl = module_path / "dist" / "module1-0.1-py2.py3-none-any.whl" assert whl.exists() with zipfile.ZipFile(str(whl)) as z: assert "module1.py" in z.namelist()
def test_wheel_package_src(): module_path = fixtures_dir / "source_package" WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO()) whl = module_path / "dist" / "package_src-0.1-py2.py3-none-any.whl" assert whl.exists() with zipfile.ZipFile(str(whl)) as z: assert "package_src/__init__.py" in z.namelist() assert "package_src/module.py" in z.namelist()
def test_wheel_package_pep_561_stub_only(package): root = fixtures_dir / package WheelBuilder.make(Factory().create_poetry(root), NullEnv(), NullIO()) whl = root / "dist" / "pep_561_stubs-0.1-py3-none-any.whl" assert whl.exists() with zipfile.ZipFile(str(whl)) as z: assert "pkg-stubs/__init__.pyi" in z.namelist() assert "pkg-stubs/module.pyi" in z.namelist() assert "pkg-stubs/subpkg/__init__.pyi" in z.namelist()
def test_wheel_excluded_data(): module_path = fixtures_dir / "default_with_excluded_data_toml" WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO()) whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl" assert whl.exists() with zipfile.ZipFile(str(whl)) as z: assert "my_package/__init__.py" in z.namelist() assert "my_package/data/sub_data/data2.txt" in z.namelist() assert "my_package/data/sub_data/data3.txt" in z.namelist() assert "my_package/data/data1.txt" not in z.namelist()
def test_wheel_localversionlabel(): module_path = fixtures_dir / "localversionlabel" project = Factory().create_poetry(module_path) WheelBuilder.make(project, NullEnv(), NullIO()) local_version_string = "localversionlabel-0.1b1+gitbranch.buildno.1" whl = module_path / "dist" / (local_version_string + "-py2.py3-none-any.whl") assert whl.exists() with zipfile.ZipFile(str(whl)) as z: assert local_version_string + ".dist-info/METADATA" in z.namelist() uploader = Uploader(project, NullIO()) assert whl in uploader.files
def test_wheel_includes_licenses_in_correct_paths(): root = fixtures_dir / "licenses_and_copying" WheelBuilder.make(Factory().create_poetry(root), NullEnv(), NullIO()) whl = root / "dist" / "my_package-1.2.3-py3-none-any.whl" assert whl.exists() with zipfile.ZipFile(str(whl)) as z: assert "my_package-1.2.3.dist-info/COPYING" in z.namelist() assert "my_package-1.2.3.dist-info/COPYING.txt" in z.namelist() assert "my_package-1.2.3.dist-info/LICENSE" in z.namelist() assert "my_package-1.2.3.dist-info/LICENSE.md" in z.namelist() assert "my_package-1.2.3.dist-info/LICENSES/CUSTOM-LICENSE" in z.namelist( ) assert "my_package-1.2.3.dist-info/LICENSES/BSD-3.md" in z.namelist() assert "my_package-1.2.3.dist-info/LICENSES/MIT.txt" in z.namelist()
def test_dist_info_file_permissions(): module_path = fixtures_dir / "complete" WheelBuilder.make(Factory().create_poetry(module_path), NullEnv(), NullIO()) whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl" with zipfile.ZipFile(str(whl)) as z: assert (z.getinfo("my_package-1.2.3.dist-info/WHEEL").external_attr == 0o644 << 16) assert (z.getinfo("my_package-1.2.3.dist-info/METADATA").external_attr == 0o644 << 16) assert (z.getinfo("my_package-1.2.3.dist-info/RECORD").external_attr == 0o644 << 16) assert (z.getinfo("my_package-1.2.3.dist-info/entry_points.txt"). external_attr == 0o644 << 16)