[Checkins] SVN: z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py make the assertion error actually provide any useful information

Ethan Jucovy ejucovy at openplans.org
Fri Jan 30 11:35:55 EST 2009


Log message for revision 95584:
  make the assertion error actually provide any useful information

Changed:
  U   z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py

-=-
Modified: z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py
===================================================================
--- z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py	2009-01-30 16:28:23 UTC (rev 95583)
+++ z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py	2009-01-30 16:35:55 UTC (rev 95584)
@@ -1,5 +1,6 @@
 import os
 from pkg_resources import find_distributions
+from pprint import pformat
 import sys
 from zope.dottedname.resolve import resolve
 
@@ -96,9 +97,11 @@
             return valid_dists_for_package[0][0]
 
         valid_dists_for_package = non_namespaced_dists ### if we have packages 'foo', 'foo.bar', and 'foo.baz', the correct one is 'foo'.
-        assert len(non_namespaced_dists) == 1          ### we really are in trouble if we get into a situation with more than one
-                                                       ### non-namespaced package at this point.
 
+        ### we really are in trouble if we get into a situation with more than one non-namespaced package at this point.
+        assert len(non_namespaced_dists) == 1, "We have a problem!\nnon_namespaced_dists: %s\nsys.path: %s" % (
+            pformat(non_namespaced_dists), pformat(sys.path))
+
     return valid_dists_for_package[0][0]
 
 def namespaceDottedNames(dist):



More information about the Checkins mailing list