0001 """Tests for distutils.command.install.""" 0002 0003 import os 0004 import unittest 0005 0006 from distutils.command.install import install 0007 from distutils.core import Distribution 0008 0009 from distutils.tests import support 0010 0011 0012 class InstallTestCase(support.TempdirManager, unittest.TestCase): 0013 0014 def test_home_installation_scheme(self): 0015 # This ensure two things: 0016 # - that --home generates the desired set of directory names 0017 # - test --home is supported on all platforms 0018 builddir = self.mkdtemp() 0019 destination = os.path.join(builddir, "installation") 0020 0021 dist = Distribution({"name": "foopkg"}) 0022 # script_name need not exist, it just need to be initialized 0023 dist.script_name = os.path.join(builddir, "setup.py") 0024 dist.command_obj["build"] = support.DummyCommand( 0025 build_base=builddir, 0026 build_lib=os.path.join(builddir, "lib"), 0027 ) 0028 0029 cmd = install(dist) 0030 cmd.home = destination 0031 cmd.ensure_finalized() 0032 0033 self.assertEqual(cmd.install_base, destination) 0034 self.assertEqual(cmd.install_platbase, destination) 0035 0036 def check_path(got, expected): 0037 got = os.path.normpath(got) 0038 expected = os.path.normpath(expected) 0039 self.assertEqual(got, expected) 0040 0041 libdir = os.path.join(destination, "lib", "python") 0042 check_path(cmd.install_lib, libdir) 0043 check_path(cmd.install_platlib, libdir) 0044 check_path(cmd.install_purelib, libdir) 0045 check_path(cmd.install_headers, 0046 os.path.join(destination, "include", "python", "foopkg")) 0047 check_path(cmd.install_scripts, os.path.join(destination, "bin")) 0048 check_path(cmd.install_data, destination) 0049 0050 0051 def test_suite(): 0052 return unittest.makeSuite(InstallTestCase) 0053 0054 if __name__ == "__main__": 0055 unittest.main(defaultTest="test_suite") 0056
Generated by PyXR 0.9.4