1"""Tests for distutils.command.install_headers.""" 2import sys 3import os 4import unittest 5import getpass 6 7from distutils.command.install_headers import install_headers 8from distutils.tests import support 9from test.test_support import run_unittest 10 11class InstallHeadersTestCase(support.TempdirManager, 12 support.LoggingSilencer, 13 support.EnvironGuard, 14 unittest.TestCase): 15 16 def test_simple_run(self): 17 # we have two headers 18 header_list = self.mkdtemp() 19 header1 = os.path.join(header_list, 'header1') 20 header2 = os.path.join(header_list, 'header2') 21 self.write_file(header1) 22 self.write_file(header2) 23 headers = [header1, header2] 24 25 pkg_dir, dist = self.create_dist(headers=headers) 26 cmd = install_headers(dist) 27 self.assertEqual(cmd.get_inputs(), headers) 28 29 # let's run the command 30 cmd.install_dir = os.path.join(pkg_dir, 'inst') 31 cmd.ensure_finalized() 32 cmd.run() 33 34 # let's check the results 35 self.assertEqual(len(cmd.get_outputs()), 2) 36 37def test_suite(): 38 return unittest.makeSuite(InstallHeadersTestCase) 39 40if __name__ == "__main__": 41 run_unittest(test_suite()) 42