/opt/imh-python/lib/python3.9/distutils/tests
NameSizeModeActions
__pycache__/-0755rm
includetest.rst250644editdlrm
Setup.sample22490644editdlrm
support.py64780644editdlrm
test_archive_util.py143010644editdlrm
test_bdist.py18930644editdlrm
test_bdist_dumb.py29050644editdlrm
test_bdist_msi.py8030644editdlrm
test_bdist_rpm.py50080644editdlrm
test_bdist_wininst.py13900644editdlrm
test_build.py19650644editdlrm
test_build_clib.py46310644editdlrm
test_build_ext.py206330644editdlrm
test_build_py.py63350644editdlrm
test_build_scripts.py35930644editdlrm
test_check.py57110644editdlrm
test_clean.py14410644editdlrm
test_cmd.py38350644editdlrm
test_config.py38920644editdlrm
test_config_cmd.py30230644editdlrm
test_core.py40770644editdlrm
test_cygwinccompiler.py56360644editdlrm
test_dep_util.py28200644editdlrm
test_dir_util.py46540644editdlrm
test_dist.py190800644editdlrm
test_extension.py27680644editdlrm
test_filelist.py114750644editdlrm
test_file_util.py44130644editdlrm
test_install.py86120644editdlrm
test_install_data.py25770644editdlrm
test_install_headers.py12380644editdlrm
test_install_lib.py39740644editdlrm
test_install_scripts.py26250644editdlrm
test_log.py18640644editdlrm
test_msvc9compiler.py60380644editdlrm
test_msvccompiler.py28450644editdlrm
test_register.py97650644editdlrm
test_sdist.py170470644editdlrm
test_spawn.py54600644editdlrm
test_sysconfig.py110450644editdlrm
test_text_file.py34360644editdlrm
test_unixccompiler.py46280644editdlrm
test_upload.py71370644editdlrm
test_util.py115720644editdlrm
test_version.py34500644editdlrm
test_versionpredicate.py2800644editdlrm
xxmodule.c129150644editdlrm
__init__.py13440644editdlrm
Edit: /opt/imh-python/lib/python3.9/distutils/tests/test_build_scripts.py (3593B)
"""Tests for distutils.command.build_scripts.""" import os import unittest from distutils.command.build_scripts import build_scripts from distutils.core import Distribution from distutils import sysconfig from distutils.tests import support from test.support import run_unittest class BuildScriptsTestCase(support.TempdirManager, support.LoggingSilencer, unittest.TestCase): def test_default_settings(self): cmd = self.get_build_scripts_cmd("/foo/bar", []) self.assertFalse(cmd.force) self.assertIsNone(cmd.build_dir) cmd.finalize_options() self.assertTrue(cmd.force) self.assertEqual(cmd.build_dir, "/foo/bar") def test_build(self): source = self.mkdtemp() target = self.mkdtemp() expected = self.write_sample_scripts(source) cmd = self.get_build_scripts_cmd(target, [os.path.join(source, fn) for fn in expected]) cmd.finalize_options() cmd.run() built = os.listdir(target) for name in expected: self.assertIn(name, built) def get_build_scripts_cmd(self, target, scripts): import sys dist = Distribution() dist.scripts = scripts dist.command_obj["build"] = support.DummyCommand( build_scripts=target, force=1, executable=sys.executable ) return build_scripts(dist) def write_sample_scripts(self, dir): expected = [] expected.append("script1.py") self.write_script(dir, "script1.py", ("#! /usr/bin/env python2.3\n" "# bogus script w/ Python sh-bang\n" "pass\n")) expected.append("script2.py") self.write_script(dir, "script2.py", ("#!/usr/bin/python\n" "# bogus script w/ Python sh-bang\n" "pass\n")) expected.append("shell.sh") self.write_script(dir, "shell.sh", ("#!/bin/sh\n" "# bogus shell script w/ sh-bang\n" "exit 0\n")) return expected def write_script(self, dir, name, text): f = open(os.path.join(dir, name), "w") try: f.write(text) finally: f.close() def test_version_int(self): source = self.mkdtemp() target = self.mkdtemp() expected = self.write_sample_scripts(source) cmd = self.get_build_scripts_cmd(target, [os.path.join(source, fn) for fn in expected]) cmd.finalize_options() # http://bugs.python.org/issue4524 # # On linux-g++-32 with command line `./configure --enable-ipv6 # --with-suffix=3`, python is compiled okay but the build scripts # failed when writing the name of the executable old = sysconfig.get_config_vars().get('VERSION') sysconfig._config_vars['VERSION'] = 4 try: cmd.run() finally: if old is not None: sysconfig._config_vars['VERSION'] = old built = os.listdir(target) for name in expected: self.assertIn(name, built) def test_suite(): return unittest.makeSuite(BuildScriptsTestCase) if __name__ == "__main__": run_unittest(test_suite())