[py-svn] r10524 - in py/branch/py-collect/test: . tkinter

hpk at codespeak.net hpk at codespeak.net
Sun Apr 10 23:29:35 CEST 2005


Author: hpk
Date: Sun Apr 10 23:29:35 2005
New Revision: 10524

Modified:
   py/branch/py-collect/test/collect.py
   py/branch/py-collect/test/config.py
   py/branch/py-collect/test/defaultconftest.py
   py/branch/py-collect/test/tkinter/tkgui.py
Log:
small renames and fixes


Modified: py/branch/py-collect/test/collect.py
==============================================================================
--- py/branch/py-collect/test/collect.py	(original)
+++ py/branch/py-collect/test/collect.py	Sun Apr 10 23:29:35 2005
@@ -35,7 +35,7 @@
 def configproperty(name):
     def fget(self):
         #print "retrieving %r property from %s" %(name, self.fspath)
-        return py.test.Config.getlocalvalue(self.fspath, name)
+        return py.test.Config.getvalue(name, self.fspath) 
     return property(fget)
 
 def getfscollector(fspath):

Modified: py/branch/py-collect/test/config.py
==============================================================================
--- py/branch/py-collect/test/config.py	(original)
+++ py/branch/py-collect/test/config.py	Sun Apr 10 23:29:35 2005
@@ -37,7 +37,7 @@
         cls._config = cls() 
     _reset = classmethod(_reset)
 
-    def getlocalvalue(cls, path, name, default=dummy, trydefaultconfig=True): 
+    def getvalue(cls, name, path=None, default=dummy, trydefaultconfig=True): 
         """ return 'name' value looked up from the first conftest file 
             found up the path (including the path itself). 
         """
@@ -50,8 +50,8 @@
                 return getattr(mod, name) 
         if default is not dummy: 
             return default 
-        raise ValueError("local config value not found: %r" % name)
-    getlocalvalue = classmethod(getlocalvalue) 
+        raise ValueError("config value not found: %r, path=%r" % (name, path))
+    getvalue = classmethod(getvalue) 
 
     def parse(cls, args): 
         """ return Config object from parsing command line arguments. 
@@ -156,10 +156,11 @@
     """ return test configuration paths from skimming the args. """ 
     d = {}
     for anchor in paths: 
-        for p in anchor.parts():
-            x = p.join(configbasename)
-            if x.check(file=1):
-                d[x] = True 
+        if anchor: 
+            for p in anchor.parts():
+                x = p.join(configbasename)
+                if x.check(file=1):
+                    d[x] = True 
     configpaths = d.keys() 
     configpaths.sort(lambda x,y: cmp(len(str(x)), len(str(y))))
     return configpaths 

Modified: py/branch/py-collect/test/defaultconftest.py
==============================================================================
--- py/branch/py-collect/test/defaultconftest.py	(original)
+++ py/branch/py-collect/test/defaultconftest.py	Sun Apr 10 23:29:35 2005
@@ -1,5 +1,4 @@
 import py
-Option = py.test.Config.Option
 
 TerminalSession = py.test.TerminalSession 
 TkinterSession = py.test.TkinterSession 
@@ -14,6 +13,7 @@
 additionalinfo = None
 
 def adddefaultoptions(): 
+    Option = py.test.Config.Option
     py.test.Config.addoptions('general options',
         Option('-v', '--verbose',
                action="count", dest="verbose", default=0,

Modified: py/branch/py-collect/test/tkinter/tkgui.py
==============================================================================
--- py/branch/py-collect/test/tkinter/tkgui.py	(original)
+++ py/branch/py-collect/test/tkinter/tkgui.py	Sun Apr 10 23:29:35 2005
@@ -360,13 +360,9 @@
                 continue
             break
 
-class TkinterSession(py.test.Session):
+class TkinterSession(py.test.Session): 
     def main(self, paths): 
         root = Tkinter.Tk()
         client = Manager(root)
         root.protocol('WM_DELETE_WINDOW', client.endApplication)
         root.mainloop()
-
-if __name__ == '__main__':
-    main()
-



More information about the pytest-commit mailing list