]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_build_py.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / distutils / tests / test_build_py.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_build_py.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_build_py.py
deleted file mode 100644 (file)
index d6e9ef1..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-"""Tests for distutils.command.build_py."""\r
-\r
-import os\r
-import sys\r
-import StringIO\r
-import unittest\r
-\r
-from distutils.command.build_py import build_py\r
-from distutils.core import Distribution\r
-from distutils.errors import DistutilsFileError\r
-\r
-from distutils.tests import support\r
-from test.test_support import run_unittest\r
-\r
-\r
-class BuildPyTestCase(support.TempdirManager,\r
-                      support.LoggingSilencer,\r
-                      unittest.TestCase):\r
-\r
-    def test_package_data(self):\r
-        sources = self.mkdtemp()\r
-        f = open(os.path.join(sources, "__init__.py"), "w")\r
-        try:\r
-            f.write("# Pretend this is a package.")\r
-        finally:\r
-            f.close()\r
-        f = open(os.path.join(sources, "README.txt"), "w")\r
-        try:\r
-            f.write("Info about this package")\r
-        finally:\r
-            f.close()\r
-\r
-        destination = self.mkdtemp()\r
-\r
-        dist = Distribution({"packages": ["pkg"],\r
-                             "package_dir": {"pkg": sources}})\r
-        # script_name need not exist, it just need to be initialized\r
-        dist.script_name = os.path.join(sources, "setup.py")\r
-        dist.command_obj["build"] = support.DummyCommand(\r
-            force=0,\r
-            build_lib=destination)\r
-        dist.packages = ["pkg"]\r
-        dist.package_data = {"pkg": ["README.txt"]}\r
-        dist.package_dir = {"pkg": sources}\r
-\r
-        cmd = build_py(dist)\r
-        cmd.compile = 1\r
-        cmd.ensure_finalized()\r
-        self.assertEqual(cmd.package_data, dist.package_data)\r
-\r
-        cmd.run()\r
-\r
-        # This makes sure the list of outputs includes byte-compiled\r
-        # files for Python modules but not for package data files\r
-        # (there shouldn't *be* byte-code files for those!).\r
-        #\r
-        self.assertEqual(len(cmd.get_outputs()), 3)\r
-        pkgdest = os.path.join(destination, "pkg")\r
-        files = os.listdir(pkgdest)\r
-        self.assertIn("__init__.py", files)\r
-        self.assertIn("README.txt", files)\r
-        # XXX even with -O, distutils writes pyc, not pyo; bug?\r
-        if sys.dont_write_bytecode:\r
-            self.assertNotIn("__init__.pyc", files)\r
-        else:\r
-            self.assertIn("__init__.pyc", files)\r
-\r
-    def test_empty_package_dir(self):\r
-        # See SF 1668596/1720897.\r
-        cwd = os.getcwd()\r
-\r
-        # create the distribution files.\r
-        sources = self.mkdtemp()\r
-        open(os.path.join(sources, "__init__.py"), "w").close()\r
-\r
-        testdir = os.path.join(sources, "doc")\r
-        os.mkdir(testdir)\r
-        open(os.path.join(testdir, "testfile"), "w").close()\r
-\r
-        os.chdir(sources)\r
-        old_stdout = sys.stdout\r
-        sys.stdout = StringIO.StringIO()\r
-\r
-        try:\r
-            dist = Distribution({"packages": ["pkg"],\r
-                                 "package_dir": {"pkg": ""},\r
-                                 "package_data": {"pkg": ["doc/*"]}})\r
-            # script_name need not exist, it just need to be initialized\r
-            dist.script_name = os.path.join(sources, "setup.py")\r
-            dist.script_args = ["build"]\r
-            dist.parse_command_line()\r
-\r
-            try:\r
-                dist.run_commands()\r
-            except DistutilsFileError:\r
-                self.fail("failed package_data test when package_dir is ''")\r
-        finally:\r
-            # Restore state.\r
-            os.chdir(cwd)\r
-            sys.stdout = old_stdout\r
-\r
-    def test_dont_write_bytecode(self):\r
-        # makes sure byte_compile is not used\r
-        pkg_dir, dist = self.create_dist()\r
-        cmd = build_py(dist)\r
-        cmd.compile = 1\r
-        cmd.optimize = 1\r
-\r
-        old_dont_write_bytecode = sys.dont_write_bytecode\r
-        sys.dont_write_bytecode = True\r
-        try:\r
-            cmd.byte_compile([])\r
-        finally:\r
-            sys.dont_write_bytecode = old_dont_write_bytecode\r
-\r
-        self.assertIn('byte-compiling is disabled', self.logs[0][1])\r
-\r
-def test_suite():\r
-    return unittest.makeSuite(BuildPyTestCase)\r
-\r
-if __name__ == "__main__":\r
-    run_unittest(test_suite())\r