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_distutils_adoption.py
Close
import os import platform import sys import textwrap import pytest IS_PYPY = '__pypy__' in sys.builtin_module_names _TEXT_KWARGS = {"text": True, "encoding": "utf-8"} # For subprocess.run def win_sr(env): """ On Windows, SYSTEMROOT must be present to avoid > Fatal Python error: _Py_HashRandomization_Init: failed to > get random numbers to initialize Python """ if env and platform.system() == 'Windows': env['SYSTEMROOT'] = os.environ['SYSTEMROOT'] return env def find_distutils(venv, imports='distutils', env=None, **kwargs): py_cmd = 'import {imports}; print(distutils.__file__)'.format(**locals()) cmd = ['python', '-c', py_cmd] return venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS, **kwargs) def count_meta_path(venv, env=None): py_cmd = textwrap.dedent( """ import sys is_distutils = lambda finder: finder.__class__.__name__ == "DistutilsMetaFinder" print(len(list(filter(is_distutils, sys.meta_path)))) """ ) cmd = ['python', '-c', py_cmd] return int(venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS)) skip_without_stdlib_distutils = pytest.mark.skipif( sys.version_info >= (3, 12), reason='stdlib distutils is removed from Python 3.12+', ) @skip_without_stdlib_distutils def test_distutils_stdlib(venv): """ Ensure stdlib distutils is used when appropriate. """ env = dict(SETUPTOOLS_USE_DISTUTILS='stdlib') assert venv.name not in find_distutils(venv, env=env).split(os.sep) assert count_meta_path(venv, env=env) == 0 def test_distutils_local_with_setuptools(venv): """ Ensure local distutils is used when appropriate. """ env = dict(SETUPTOOLS_USE_DISTUTILS='local') loc = find_distutils(venv, imports='setuptools, distutils', env=env) assert venv.name in loc.split(os.sep) assert count_meta_path(venv, env=env) <= 1 @pytest.mark.xfail('IS_PYPY', reason='pypy imports distutils on startup') def test_distutils_local(venv): """ Even without importing, the setuptools-local copy of distutils is preferred. """ env = dict(SETUPTOOLS_USE_DISTUTILS='local') assert venv.name in find_distutils(venv, env=env).split(os.sep) assert count_meta_path(venv, env=env) <= 1 def test_pip_import(venv): """ Ensure pip can be imported. Regression test for #3002. """ cmd = ['python', '-c', 'import pip'] venv.run(cmd, **_TEXT_KWARGS) def test_distutils_has_origin(): """ Distutils module spec should have an origin. #2990. """ assert __import__('distutils').__spec__.origin ENSURE_IMPORTS_ARE_NOT_DUPLICATED = r""" # Depending on the importlib machinery and _distutils_hack, some imports are # duplicated resulting in different module objects being loaded, which prevents # patches as shown in #3042. # This script provides a way of verifying if this duplication is happening. from distutils import cmd import distutils.command.sdist as sdist # import last to prevent caching from distutils import {imported_module} for mod in (cmd, sdist): assert mod.{imported_module} == {imported_module}, ( f"\n{{mod.dir_util}}\n!=\n{{{imported_module}}}" ) print("success") """ @pytest.mark.usefixtures("tmpdir_cwd") @pytest.mark.parametrize( ('distutils_version', 'imported_module'), [ pytest.param("stdlib", "dir_util", marks=skip_without_stdlib_distutils), pytest.param("stdlib", "file_util", marks=skip_without_stdlib_distutils), pytest.param("stdlib", "archive_util", marks=skip_without_stdlib_distutils), ("local", "dir_util"), ("local", "file_util"), ("local", "archive_util"), ], ) def test_modules_are_not_duplicated_on_import(distutils_version, imported_module, venv): env = dict(SETUPTOOLS_USE_DISTUTILS=distutils_version) script = ENSURE_IMPORTS_ARE_NOT_DUPLICATED.format(imported_module=imported_module) cmd = ['python', '-c', script] output = venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS).strip() assert output == "success" ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED = r""" import types import distutils.dist as dist from distutils import log if isinstance(dist.log, types.ModuleType): assert dist.log == log, f"\n{dist.log}\n!=\n{log}" print("success") """ @pytest.mark.usefixtures("tmpdir_cwd") @pytest.mark.parametrize( "distutils_version", [ "local", pytest.param("stdlib", marks=skip_without_stdlib_distutils), ], ) def test_log_module_is_not_duplicated_on_import(distutils_version, venv): env = dict(SETUPTOOLS_USE_DISTUTILS=distutils_version) cmd = ['python', '-c', ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED] output = venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS).strip() assert output == "success" ENSURE_CONSISTENT_ERROR_FROM_MODIFIED_PY = r""" from setuptools.modified import newer from {imported_module}.errors import DistutilsError # Can't use pytest.raises in this context try: newer("", "") except DistutilsError: print("success") else: raise AssertionError("Expected to raise") """ @pytest.mark.usefixtures("tmpdir_cwd") @pytest.mark.parametrize( ('distutils_version', 'imported_module'), [ ("local", "distutils"), # Unfortunately we still get ._distutils.errors.DistutilsError with SETUPTOOLS_USE_DISTUTILS=stdlib # But that's a deprecated use-case we don't mind not fully supporting in newer code pytest.param( "stdlib", "setuptools._distutils", marks=skip_without_stdlib_distutils ), ], ) def test_consistent_error_from_modified_py(distutils_version, imported_module, venv): env = dict(SETUPTOOLS_USE_DISTUTILS=distutils_version) cmd = [ 'python', '-c', ENSURE_CONSISTENT_ERROR_FROM_MODIFIED_PY.format( imported_module=imported_module ), ] output = venv.run(cmd, env=win_sr(env), **_TEXT_KWARGS).strip() assert output == "success"