Staging
v0.5.1
swh:1:snp:635f4099902912592851108bcac178ff574f7c5f
Raw File
Tip revision: d12551fe71ffa19cc57986b06c2097b4b87949a4 authored by Larry Hastings on 02 January 2017, 06:12:36 UTC
Version bump for 3.4.6rc1.
Tip revision: d12551f
test_pdeps.py
"""Tests for the pdeps script in the Tools directory."""

import os
import sys
import unittest
import tempfile
from test import support

from test.test_tools import scriptsdir, skip_if_missing, import_tool

skip_if_missing()


class PdepsTests(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        self.pdeps = import_tool('pdeps')

    def test_process_errors(self):
        # Issue #14492: m_import.match(line) can be None.
        with tempfile.TemporaryDirectory() as tmpdir:
            fn = os.path.join(tmpdir, 'foo')
            with open(fn, 'w') as stream:
                stream.write("#!/this/will/fail")
            self.pdeps.process(fn, {})

    def test_inverse_attribute_error(self):
        # Issue #14492: this used to fail with an AttributeError.
        self.pdeps.inverse({'a': []})


if __name__ == '__main__':
    unittest.main()
back to top