/opt/cloudlinux/venv/lib/python3.11/site-packages/setuptools/_distutils/tests
"""Tests for distutils.command.bdist_dumb.""" import os import sys import zipfile from distutils.command.bdist_dumb import bdist_dumb from distutils.core import Distribution from distutils.tests import support import pytest SETUP_PY = """\ from distutils.core import setup import foo setup(name='foo', version='0.1', py_modules=['foo'], url='xxx', author='xxx', author_email='xxx') """ @support.combine_markers @pytest.mark.usefixtures('save_env') @pytest.mark.usefixtures('save_argv') @pytest.mark.usefixtures('save_cwd') class TestBuildDumb( support.TempdirManager, ): @pytest.mark.usefixtures('needs_zlib') def test_simple_built(self): # let's create a simple package tmp_dir = self.mkdtemp() pkg_dir = os.path.join(tmp_dir, 'foo') os.mkdir(pkg_dir) self.write_file((pkg_dir, 'setup.py'), SETUP_PY) self.write_file((pkg_dir, 'foo.py'), '#') self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py') self.write_file((pkg_dir, 'README'), '') dist = Distribution({ 'name': 'foo', 'version': '0.1', 'py_modules': ['foo'], 'url': 'xxx', 'author': 'xxx', 'author_email': 'xxx', }) dist.script_name = 'setup.py' os.chdir(pkg_dir) sys.argv = ['setup.py'] cmd = bdist_dumb(dist) # so the output is the same no matter # what is the platform cmd.format = 'zip' cmd.ensure_finalized() cmd.run() # see what we have dist_created = os.listdir(os.path.join(pkg_dir, 'dist')) base = f"{dist.get_fullname()}.{cmd.plat_name}.zip" assert dist_created == [base] # now let's check what we have in the zip file fp = zipfile.ZipFile(os.path.join('dist', base)) try: contents = fp.namelist() finally: fp.close() contents = sorted(filter(None, map(os.path.basename, contents))) wanted = ['foo-0.1-py{}.{}.egg-info'.format(*sys.version_info[:2]), 'foo.py'] if not sys.dont_write_bytecode: wanted.append(f'foo.{sys.implementation.cache_tag}.pyc') assert contents == sorted(wanted)
.
Edit
..
Edit
__init__.py
Edit
__pycache__
Edit
compat
Edit
support.py
Edit
test_archive_util.py
Edit
test_bdist.py
Edit
test_bdist_dumb.py
Edit
test_bdist_rpm.py
Edit
test_build.py
Edit
test_build_clib.py
Edit
test_build_ext.py
Edit
test_build_py.py
Edit
test_build_scripts.py
Edit
test_check.py
Edit
test_clean.py
Edit
test_cmd.py
Edit
test_config_cmd.py
Edit
test_core.py
Edit
test_dir_util.py
Edit
test_dist.py
Edit
test_extension.py
Edit
test_file_util.py
Edit
test_filelist.py
Edit
test_install.py
Edit
test_install_data.py
Edit
test_install_headers.py
Edit
test_install_lib.py
Edit
test_install_scripts.py
Edit
test_log.py
Edit
test_modified.py
Edit
test_sdist.py
Edit
test_spawn.py
Edit
test_sysconfig.py
Edit
test_text_file.py
Edit
test_util.py
Edit
test_version.py
Edit
test_versionpredicate.py
Edit
unix_compat.py
Edit