summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-04-06 02:59:13 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-04-06 02:59:13 (GMT)
commitd3af6344ef43df20c91be8275a5e874dc0589830 (patch)
treeb79357fe24c74e978793b91af11ad73a26c6b905 /Lib
parentfee3fc748e4c6e00cdd44c079e54cacef00690cf (diff)
downloadcpython-d3af6344ef43df20c91be8275a5e874dc0589830.zip
cpython-d3af6344ef43df20c91be8275a5e874dc0589830.tar.gz
cpython-d3af6344ef43df20c91be8275a5e874dc0589830.tar.bz2
#14492: fix some bugs in Tools/scripts/pdeps.py.
Initial patch by Popa Claudiu.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_tools.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_tools.py b/Lib/test/test_tools.py
index 83a1e0d..cfe13ac 100644
--- a/Lib/test/test_tools.py
+++ b/Lib/test/test_tools.py
@@ -6,8 +6,10 @@ Tools directory of a Python checkout or tarball, such as reindent.py.
import os
import sys
+import imp
import unittest
import sysconfig
+import tempfile
from test import support
from test.script_helper import assert_python_ok
@@ -72,6 +74,31 @@ class TestSundryScripts(unittest.TestCase):
import analyze_dxp
+class PdepsTests(unittest.TestCase):
+
+ @classmethod
+ def setUpClass(self):
+ path = os.path.join(scriptsdir, 'pdeps.py')
+ self.pdeps = imp.load_source('pdeps', path)
+
+ @classmethod
+ def tearDownClass(self):
+ if 'pdeps' in sys.modules:
+ del sys.modules['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': []})
+
+
def test_main():
support.run_unittest(*[obj for obj in globals().values()
if isinstance(obj, type)])