OXIESEC PANEL
- Current Dir:
/
/
snap
/
certbot
/
4737
/
lib
/
python3.12
/
site-packages
/
setuptools
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📄
__init__.py
335 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📁
__pycache__
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📁
compat
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📁
config
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📄
contexts.py
3.4 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
environment.py
3.03 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
fixtures.py
11.43 KB
06/12/2025 06:19:25 PM
rw-r--r--
📁
indexes
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📁
integration
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📄
mod_with_constant.py
22 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
namespaces.py
2.71 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
script-with-bom.py
18 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_archive_util.py
845 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_bdist_deprecations.py
775 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_bdist_egg.py
1.91 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_bdist_wheel.py
22.54 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_build.py
798 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_build_clib.py
3.05 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_build_ext.py
9.86 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_build_meta.py
32.51 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_build_py.py
13.85 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_config_discovery.py
22.05 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_core_metadata.py
20.39 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_depends.py
424 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_develop.py
2.97 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_dist.py
8.68 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_dist_info.py
6.91 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_distutils_adoption.py
5.85 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_editable_install.py
41.65 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_egg_info.py
43.89 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_extern.py
296 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_find_packages.py
7.64 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_find_py_modules.py
2.35 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_glob.py
887 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_install_scripts.py
3.35 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_logging.py
2.05 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_manifest.py
18.13 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_namespaces.py
4.41 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_scripts.py
379 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_sdist.py
32.1 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_setopt.py
1.33 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_setuptools.py
8.8 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_shutil_wrapper.py
641 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_unicode_utils.py
316 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_virtualenv.py
3.64 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_warnings.py
3.27 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_wheel.py
18.92 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
test_windows_wrappers.py
7.65 KB
06/12/2025 06:19:25 PM
rw-r--r--
📄
text.py
123 bytes
06/12/2025 06:19:25 PM
rw-r--r--
📄
textwrap.py
98 bytes
06/12/2025 06:19:25 PM
rw-r--r--
Editing: test_dist_info.py
Close
"""Test .dist-info style distributions.""" import pathlib import re import shutil import subprocess import sys from functools import partial import pytest import pkg_resources from setuptools.archive_util import unpack_archive from .textwrap import DALS read = partial(pathlib.Path.read_text, encoding="utf-8") class TestDistInfo: metadata_base = DALS( """ Metadata-Version: 1.2 Requires-Dist: splort (==4) Provides-Extra: baz Requires-Dist: quux (>=1.1); extra == 'baz' """ ) @classmethod def build_metadata(cls, **kwargs): lines = ('{key}: {value}\n'.format(**locals()) for key, value in kwargs.items()) return cls.metadata_base + ''.join(lines) @pytest.fixture def metadata(self, tmpdir): dist_info_name = 'VersionedDistribution-2.718.dist-info' versioned = tmpdir / dist_info_name versioned.mkdir() filename = versioned / 'METADATA' content = self.build_metadata( Name='VersionedDistribution', ) filename.write_text(content, encoding='utf-8') dist_info_name = 'UnversionedDistribution.dist-info' unversioned = tmpdir / dist_info_name unversioned.mkdir() filename = unversioned / 'METADATA' content = self.build_metadata( Name='UnversionedDistribution', Version='0.3', ) filename.write_text(content, encoding='utf-8') return str(tmpdir) def test_distinfo(self, metadata): dists = dict( (d.project_name, d) for d in pkg_resources.find_distributions(metadata) ) assert len(dists) == 2, dists unversioned = dists['UnversionedDistribution'] versioned = dists['VersionedDistribution'] assert versioned.version == '2.718' # from filename assert unversioned.version == '0.3' # from METADATA def test_conditional_dependencies(self, metadata): specs = 'splort==4', 'quux>=1.1' requires = list(map(pkg_resources.Requirement.parse, specs)) for d in pkg_resources.find_distributions(metadata): assert d.requires() == requires[:1] assert d.requires(extras=('baz',)) == [ requires[0], pkg_resources.Requirement.parse('quux>=1.1;extra=="baz"'), ] assert d.extras == ['baz'] def test_invalid_version(self, tmp_path): """ Supplying an invalid version crashes dist_info. """ config = "[metadata]\nname=proj\nversion=42\n[egg_info]\ntag_build=invalid!!!\n" (tmp_path / "setup.cfg").write_text(config, encoding="utf-8") msg = re.compile("invalid version", re.M | re.I) proc = run_command_inner("dist_info", cwd=tmp_path, check=False) assert proc.returncode assert msg.search(proc.stdout) assert not list(tmp_path.glob("*.dist-info")) def test_tag_arguments(self, tmp_path): config = """ [metadata] name=proj version=42 [egg_info] tag_date=1 tag_build=.post """ (tmp_path / "setup.cfg").write_text(config, encoding="utf-8") print(run_command("dist_info", "--no-date", cwd=tmp_path)) dist_info = next(tmp_path.glob("*.dist-info")) assert dist_info.name.startswith("proj-42") shutil.rmtree(dist_info) print(run_command("dist_info", "--tag-build", ".a", cwd=tmp_path)) dist_info = next(tmp_path.glob("*.dist-info")) assert dist_info.name.startswith("proj-42a") @pytest.mark.parametrize("keep_egg_info", (False, True)) def test_output_dir(self, tmp_path, keep_egg_info): config = "[metadata]\nname=proj\nversion=42\n" (tmp_path / "setup.cfg").write_text(config, encoding="utf-8") out = tmp_path / "__out" out.mkdir() opts = ["--keep-egg-info"] if keep_egg_info else [] run_command("dist_info", "--output-dir", out, *opts, cwd=tmp_path) assert len(list(out.glob("*.dist-info"))) == 1 assert len(list(tmp_path.glob("*.dist-info"))) == 0 expected_egg_info = int(keep_egg_info) assert len(list(out.glob("*.egg-info"))) == expected_egg_info assert len(list(tmp_path.glob("*.egg-info"))) == 0 assert len(list(out.glob("*.__bkp__"))) == 0 assert len(list(tmp_path.glob("*.__bkp__"))) == 0 class TestWheelCompatibility: """Make sure the .dist-info directory produced with the ``dist_info`` command is the same as the one produced by ``bdist_wheel``. """ SETUPCFG = DALS( """ [metadata] name = {name} version = {version} [options] install_requires = foo>=12; sys_platform != "linux" [options.extras_require] test = pytest [options.entry_points] console_scripts = executable-name = my_package.module:function discover = myproj = my_package.other_module:function """ ) EGG_INFO_OPTS = [ # Related: #3088 #2872 ("", ""), (".post", "[egg_info]\ntag_build = post\n"), (".post", "[egg_info]\ntag_build = .post\n"), (".post", "[egg_info]\ntag_build = post\ntag_date = 1\n"), (".dev", "[egg_info]\ntag_build = .dev\n"), (".dev", "[egg_info]\ntag_build = .dev\ntag_date = 1\n"), ("a1", "[egg_info]\ntag_build = .a1\n"), ("+local", "[egg_info]\ntag_build = +local\n"), ] @pytest.mark.parametrize("name", "my-proj my_proj my.proj My.Proj".split()) @pytest.mark.parametrize("version", ["0.42.13"]) @pytest.mark.parametrize(("suffix", "cfg"), EGG_INFO_OPTS) def test_dist_info_is_the_same_as_in_wheel( self, name, version, tmp_path, suffix, cfg ): config = self.SETUPCFG.format(name=name, version=version) + cfg for i in "dir_wheel", "dir_dist": (tmp_path / i).mkdir() (tmp_path / i / "setup.cfg").write_text(config, encoding="utf-8") run_command("bdist_wheel", cwd=tmp_path / "dir_wheel") wheel = next(tmp_path.glob("dir_wheel/dist/*.whl")) unpack_archive(wheel, tmp_path / "unpack") wheel_dist_info = next(tmp_path.glob("unpack/*.dist-info")) run_command("dist_info", cwd=tmp_path / "dir_dist") dist_info = next(tmp_path.glob("dir_dist/*.dist-info")) assert dist_info.name == wheel_dist_info.name assert dist_info.name.startswith(f"my_proj-{version}{suffix}") for file in "METADATA", "entry_points.txt": assert read(dist_info / file) == read(wheel_dist_info / file) def run_command_inner(*cmd, **kwargs): opts = { "stderr": subprocess.STDOUT, "stdout": subprocess.PIPE, "text": True, "encoding": "utf-8", "check": True, **kwargs, } cmd = [sys.executable, "-c", "__import__('setuptools').setup()", *map(str, cmd)] return subprocess.run(cmd, **opts) def run_command(*args, **kwargs): return run_command_inner(*args, **kwargs).stdout