[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/tests/test.py minor code cleanup

Fred L. Drake, Jr. fred at zope.com
Wed Jun 2 15:27:48 EDT 2004


Log message for revision 25197:
minor code cleanup


-=-
Modified: Zope3/trunk/src/zope/app/tests/test.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/test.py	2004-06-02 19:06:50 UTC (rev 25196)
+++ Zope3/trunk/src/zope/app/tests/test.py	2004-06-02 19:27:47 UTC (rev 25197)
@@ -510,7 +510,7 @@
             self.dirname = "tests"
 
     def visit(self, rx, dir, files):
-        if os.path.split(dir)[1] != self.dirname:
+        if os.path.basename(dir) != self.dirname:
             # Allow tests/ftests module rather than package.
             modfname = self.dirname + '.py'
             if modfname in files:
@@ -598,10 +598,8 @@
     return finder.files
 
 def package_import(modname):
-    mod = __import__(modname)
-    for part in modname.split(".")[1:]:
-        mod = getattr(mod, part)
-    return mod
+    __import__(modname)
+    return sys.modules[modname]
 
 class PseudoTestCase:
     """Minimal test case objects to create error reports.




More information about the Zope3-Checkins mailing list