| Server IP : 50.21.180.56 / Your IP : 216.73.216.208 Web Server : Apache System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux User : ws67922704 ( 67922704) PHP Version : 8.5.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /kunden/usr/lib/python3/dist-packages/pkg_resources/tests/ |
Upload File : |
import shutil
from pathlib import Path
import pytest
import pkg_resources
TESTS_DATA_DIR = Path(__file__).parent / 'data'
class TestFindDistributions:
@pytest.fixture
def target_dir(self, tmpdir):
target_dir = tmpdir.mkdir('target')
# place a .egg named directory in the target that is not an egg:
target_dir.mkdir('not.an.egg')
return target_dir
def test_non_egg_dir_named_egg(self, target_dir):
dists = pkg_resources.find_distributions(str(target_dir))
assert not list(dists)
def test_standalone_egg_directory(self, target_dir):
shutil.copytree(
TESTS_DATA_DIR / 'my-test-package_unpacked-egg',
target_dir,
dirs_exist_ok=True,
)
dists = pkg_resources.find_distributions(str(target_dir))
assert [dist.project_name for dist in dists] == ['my-test-package']
dists = pkg_resources.find_distributions(str(target_dir), only=True)
assert not list(dists)
def test_zipped_egg(self, target_dir):
shutil.copytree(
TESTS_DATA_DIR / 'my-test-package_zipped-egg',
target_dir,
dirs_exist_ok=True,
)
dists = pkg_resources.find_distributions(str(target_dir))
assert [dist.project_name for dist in dists] == ['my-test-package']
dists = pkg_resources.find_distributions(str(target_dir), only=True)
assert not list(dists)
def test_zipped_sdist_one_level_removed(self, target_dir):
shutil.copytree(
TESTS_DATA_DIR / 'my-test-package-zip', target_dir, dirs_exist_ok=True
)
dists = pkg_resources.find_distributions(
str(target_dir / "my-test-package.zip")
)
assert [dist.project_name for dist in dists] == ['my-test-package']
dists = pkg_resources.find_distributions(
str(target_dir / "my-test-package.zip"), only=True
)
assert not list(dists)