403Webshell
Server IP : 192.64.118.117  /  Your IP : 3.144.108.175
Web Server : LiteSpeed
System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64
User : thecgapy ( 1160)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cloudlinux/venv/lib/python3.11/site-packages/pkg_resources/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/pkg_resources/tests/test_find_distributions.py
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)

Youez - 2016 - github.com/yon3zu
LinuXploit