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