ยปCore Development>Code coverage>Lib/distutils/tests/test_install_headers.py

Python code coverage for Lib/distutils/tests/test_install_headers.py

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