Zachary Ware | 2b0a610 | 2014-07-16 14:26:09 -0500 | [diff] [blame] | 1 | """Tests for the pdeps script in the Tools directory.""" |
| 2 | |
| 3 | import os |
Zachary Ware | 2b0a610 | 2014-07-16 14:26:09 -0500 | [diff] [blame] | 4 | import unittest |
| 5 | import tempfile |
Zachary Ware | 2b0a610 | 2014-07-16 14:26:09 -0500 | [diff] [blame] | 6 | |
Serhiy Storchaka | e437a10 | 2016-04-24 21:41:02 +0300 | [diff] [blame] | 7 | from test.test_tools import skip_if_missing, import_tool |
Zachary Ware | 2b0a610 | 2014-07-16 14:26:09 -0500 | [diff] [blame] | 8 | |
| 9 | skip_if_missing() |
| 10 | |
| 11 | |
| 12 | class PdepsTests(unittest.TestCase): |
| 13 | |
| 14 | @classmethod |
| 15 | def setUpClass(self): |
| 16 | self.pdeps = import_tool('pdeps') |
| 17 | |
| 18 | def test_process_errors(self): |
| 19 | # Issue #14492: m_import.match(line) can be None. |
| 20 | with tempfile.TemporaryDirectory() as tmpdir: |
| 21 | fn = os.path.join(tmpdir, 'foo') |
| 22 | with open(fn, 'w') as stream: |
| 23 | stream.write("#!/this/will/fail") |
| 24 | self.pdeps.process(fn, {}) |
| 25 | |
| 26 | def test_inverse_attribute_error(self): |
| 27 | # Issue #14492: this used to fail with an AttributeError. |
| 28 | self.pdeps.inverse({'a': []}) |
| 29 | |
| 30 | |
| 31 | if __name__ == '__main__': |
| 32 | unittest.main() |