/usr/share/cagefs-skeleton/opt/cloudlinux/venv/lib/python3.11/site-packages/setuptools/tests
"""Tests for automatic discovery of modules""" import os import pytest from setuptools.discovery import FlatLayoutModuleFinder, ModuleFinder from .compat.py39 import os_helper from .test_find_packages import ensure_files class TestModuleFinder: def find(self, path, *args, **kwargs): return set(ModuleFinder.find(str(path), *args, **kwargs)) EXAMPLES = { # circumstance: (files, kwargs, expected_modules) "simple_folder": ( ["file.py", "other.py"], {}, # kwargs ["file", "other"], ), "exclude": ( ["file.py", "other.py"], {"exclude": ["f*"]}, ["other"], ), "include": ( ["file.py", "fole.py", "other.py"], {"include": ["f*"], "exclude": ["fo*"]}, ["file"], ), "invalid-name": (["my-file.py", "other.file.py"], {}, []), } @pytest.mark.parametrize("example", EXAMPLES.keys()) def test_finder(self, tmp_path, example): files, kwargs, expected_modules = self.EXAMPLES[example] ensure_files(tmp_path, files) assert self.find(tmp_path, **kwargs) == set(expected_modules) @pytest.mark.skipif(not os_helper.can_symlink(), reason='Symlink support required') def test_symlinked_packages_are_included(self, tmp_path): src = "_myfiles/file.py" ensure_files(tmp_path, [src]) os.symlink(tmp_path / src, tmp_path / "link.py") assert self.find(tmp_path) == {"link"} class TestFlatLayoutModuleFinder: def find(self, path, *args, **kwargs): return set(FlatLayoutModuleFinder.find(str(path))) EXAMPLES = { # circumstance: (files, expected_modules) "hidden-files": ([".module.py"], []), "private-modules": (["_module.py"], []), "common-names": ( ["setup.py", "conftest.py", "test.py", "tests.py", "example.py", "mod.py"], ["mod"], ), "tool-specific": ( ["tasks.py", "fabfile.py", "noxfile.py", "dodo.py", "manage.py", "mod.py"], ["mod"], ), } @pytest.mark.parametrize("example", EXAMPLES.keys()) def test_unwanted_files_not_included(self, tmp_path, example): files, expected_modules = self.EXAMPLES[example] ensure_files(tmp_path, files) assert self.find(tmp_path) == set(expected_modules)
.
Edit
..
Edit
__init__.py
Edit
__pycache__
Edit
compat
Edit
config
Edit
contexts.py
Edit
environment.py
Edit
fixtures.py
Edit
indexes
Edit
integration
Edit
mod_with_constant.py
Edit
namespaces.py
Edit
script-with-bom.py
Edit
server.py
Edit
test_archive_util.py
Edit
test_bdist_deprecations.py
Edit
test_bdist_egg.py
Edit
test_bdist_wheel.py
Edit
test_build.py
Edit
test_build_clib.py
Edit
test_build_ext.py
Edit
test_build_meta.py
Edit
test_build_py.py
Edit
test_config_discovery.py
Edit
test_core_metadata.py
Edit
test_depends.py
Edit
test_develop.py
Edit
test_dist.py
Edit
test_dist_info.py
Edit
test_distutils_adoption.py
Edit
test_easy_install.py
Edit
test_editable_install.py
Edit
test_egg_info.py
Edit
test_extern.py
Edit
test_find_packages.py
Edit
test_find_py_modules.py
Edit
test_glob.py
Edit
test_install_scripts.py
Edit
test_logging.py
Edit
test_manifest.py
Edit
test_namespaces.py
Edit
test_packageindex.py
Edit
test_sandbox.py
Edit
test_sdist.py
Edit
test_setopt.py
Edit
test_setuptools.py
Edit
test_shutil_wrapper.py
Edit
test_unicode_utils.py
Edit
test_virtualenv.py
Edit
test_warnings.py
Edit
test_wheel.py
Edit
test_windows_wrappers.py
Edit
text.py
Edit
textwrap.py
Edit