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