1"""Tests for the pdeps script in the Tools directory.""" 2 3import os 4import unittest 5import tempfile 6 7from test.test_tools import skip_if_missing, import_tool 8 9skip_if_missing() 10 11 12class 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 31if __name__ == '__main__': 32 unittest.main() 33