]> granicus.if.org Git - python/commitdiff
Test that "import sys.imp" fails as it should.
authorGuido van Rossum <guido@python.org>
Tue, 19 May 1998 15:09:42 +0000 (15:09 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 19 May 1998 15:09:42 +0000 (15:09 +0000)
Lib/test/test_pkg.py

index aa0d3f035d6051b1dec160f11d0d525a36843373..fd226126449acd660fc91549b5c651b0ab29b9d2 100644 (file)
@@ -3,7 +3,7 @@
 import sys, os, string, tempfile, traceback
 from os import mkdir, rmdir             # Can't test if these fail
 del mkdir, rmdir
-from test_support import verbose
+from test_support import verbose, TestFailed
 
 # Helpers to create and destroy hierarchies.
 
@@ -212,3 +212,14 @@ for name, hier, code in tests:
         continue
     print "running test", name
     runtest(hier, code)
+
+# Test
+import sys
+import imp
+try:
+    import sys.imp
+except ImportError:
+    # This is what we expect
+    pass
+else:
+    raise TestFailed, "No ImportError exception on 'import sys.imp'"