Tarek Ziadé | baf5180 | 2009-03-31 21:37:16 +0000 | [diff] [blame] | 1 | """Tests for distutils.command.install_headers.""" |
| 2 | import sys |
| 3 | import os |
| 4 | import unittest |
| 5 | import getpass |
| 6 | |
| 7 | from distutils.command.install_headers import install_headers |
| 8 | from distutils.tests import support |
Éric Araujo | 70ec44a | 2010-11-06 02:44:43 +0000 | [diff] [blame] | 9 | from test.support import run_unittest |
Tarek Ziadé | baf5180 | 2009-03-31 21:37:16 +0000 | [diff] [blame] | 10 | |
| 11 | class InstallHeadersTestCase(support.TempdirManager, |
| 12 | support.LoggingSilencer, |
Tarek Ziadé | 430fb63 | 2009-10-18 11:34:51 +0000 | [diff] [blame] | 13 | support.EnvironGuard, |
Tarek Ziadé | baf5180 | 2009-03-31 21:37:16 +0000 | [diff] [blame] | 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.assertEquals(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.assertEquals(len(cmd.get_outputs()), 2) |
| 36 | |
| 37 | def test_suite(): |
| 38 | return unittest.makeSuite(InstallHeadersTestCase) |
| 39 | |
| 40 | if __name__ == "__main__": |
Éric Araujo | 70ec44a | 2010-11-06 02:44:43 +0000 | [diff] [blame] | 41 | run_unittest(test_suite()) |