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