ยปCore Development>Code coverage>Lib/test/test_tools/test_pdeps.py

Python code coverage for Lib/test/test_tools/test_pdeps.py

#countcontent
1n/a"""Tests for the pdeps script in the Tools directory."""
2n/a
3n/aimport os
4n/aimport unittest
5n/aimport tempfile
6n/a
7n/afrom test.test_tools import skip_if_missing, import_tool
8n/a
9n/askip_if_missing()
10n/a
11n/a
12n/aclass PdepsTests(unittest.TestCase):
13n/a
14n/a @classmethod
15n/a def setUpClass(self):
16n/a self.pdeps = import_tool('pdeps')
17n/a
18n/a def test_process_errors(self):
19n/a # Issue #14492: m_import.match(line) can be None.
20n/a with tempfile.TemporaryDirectory() as tmpdir:
21n/a fn = os.path.join(tmpdir, 'foo')
22n/a with open(fn, 'w') as stream:
23n/a stream.write("#!/this/will/fail")
24n/a self.pdeps.process(fn, {})
25n/a
26n/a def test_inverse_attribute_error(self):
27n/a # Issue #14492: this used to fail with an AttributeError.
28n/a self.pdeps.inverse({'a': []})
29n/a
30n/a
31n/aif __name__ == '__main__':
32n/a unittest.main()