]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_install_scripts.py
1 """Tests for distutils.command.install_scripts."""
6 from distutils
.command
.install_scripts
import install_scripts
7 from distutils
.core
import Distribution
9 from distutils
.tests
import support
10 from test
.test_support
import run_unittest
13 class InstallScriptsTestCase(support
.TempdirManager
,
14 support
.LoggingSilencer
,
17 def test_default_settings(self
):
19 dist
.command_obj
["build"] = support
.DummyCommand(
20 build_scripts
="/foo/bar")
21 dist
.command_obj
["install"] = support
.DummyCommand(
22 install_scripts
="/splat/funk",
26 cmd
= install_scripts(dist
)
27 self
.assertTrue(not cmd
.force
)
28 self
.assertTrue(not cmd
.skip_build
)
29 self
.assertTrue(cmd
.build_dir
is None)
30 self
.assertTrue(cmd
.install_dir
is None)
32 cmd
.finalize_options()
34 self
.assertTrue(cmd
.force
)
35 self
.assertTrue(cmd
.skip_build
)
36 self
.assertEqual(cmd
.build_dir
, "/foo/bar")
37 self
.assertEqual(cmd
.install_dir
, "/splat/funk")
39 def test_installation(self
):
40 source
= self
.mkdtemp()
43 def write_script(name
, text
):
45 f
= open(os
.path
.join(source
, name
), "w")
51 write_script("script1.py", ("#! /usr/bin/env python2.3\n"
52 "# bogus script w/ Python sh-bang\n"
54 write_script("script2.py", ("#!/usr/bin/python\n"
55 "# bogus script w/ Python sh-bang\n"
57 write_script("shell.sh", ("#!/bin/sh\n"
58 "# bogus shell script w/ sh-bang\n"
61 target
= self
.mkdtemp()
63 dist
.command_obj
["build"] = support
.DummyCommand(build_scripts
=source
)
64 dist
.command_obj
["install"] = support
.DummyCommand(
65 install_scripts
=target
,
69 cmd
= install_scripts(dist
)
70 cmd
.finalize_options()
73 installed
= os
.listdir(target
)
75 self
.assertTrue(name
in installed
)
79 return unittest
.makeSuite(InstallScriptsTestCase
)
81 if __name__
== "__main__":
82 run_unittest(test_suite())