[pypy-svn] r14643 - pypy/dist/pypy/tool/pytest

hpk at codespeak.net hpk at codespeak.net
Wed Jul 13 21:47:54 CEST 2005


Author: hpk
Date: Wed Jul 13 21:47:54 2005
New Revision: 14643

Modified:
   pypy/dist/pypy/tool/pytest/htmlreport.py
   pypy/dist/pypy/tool/pytest/overview.py
   pypy/dist/pypy/tool/pytest/result.py
Log:
issue93 testing 

the testreport pages should now work again.  
The last problem was the mixture between 
win32 and posix paths and incorrect sorting
between them.  The according code in pypy/tool/pytest/ 
needs to be refactored and generalized (also to
allow per-platform/per-python version views) but
not now. 



Modified: pypy/dist/pypy/tool/pytest/htmlreport.py
==============================================================================
--- pypy/dist/pypy/tool/pytest/htmlreport.py	(original)
+++ pypy/dist/pypy/tool/pytest/htmlreport.py	Wed Jul 13 21:47:54 2005
@@ -18,6 +18,7 @@
 class HtmlReport(object): 
     def __init__(self): 
         self.resultcache = ResultCache()
+
     def parselatest(self): 
         self.resultcache.parselatest()
 
@@ -70,14 +71,13 @@
 
     def render_test_references(self, result): 
         dest = self.make_single_test_result(result)
-        modified = result.fspath.dirpath().dirpath().basename.startswith('modified') 
-        modified = modified and " [mod]" or ""
+        modified = result.ismodifiedtest() and " [mod]" or ""
         return html.div(html.a(result.path.purebasename + modified, 
                       href=self.getrelpath(dest)),
                       style="background-color: transparent")
 
     def make_single_test_result(self, result): 
-        cache = self.indexpath.dirpath('.cache')
+        cache = self.indexpath.dirpath('.cache', result['userhost'][:15])
         cache.ensure(dir=1)
         dest = cache.join(result.path.basename).new(ext='.html')
         doc = ViewResult(result)

Modified: pypy/dist/pypy/tool/pytest/overview.py
==============================================================================
--- pypy/dist/pypy/tool/pytest/overview.py	(original)
+++ pypy/dist/pypy/tool/pytest/overview.py	Wed Jul 13 21:47:54 2005
@@ -22,7 +22,8 @@
                 raise TypeError
         except TypeError: 
             return
-        name = res.fspath.purebasename 
+        name = res.testname 
+        print name
         self.name2result.setdefault(name, []).append(res) 
         return res 
 

Modified: pypy/dist/pypy/tool/pytest/result.py
==============================================================================
--- pypy/dist/pypy/tool/pytest/result.py	(original)
+++ pypy/dist/pypy/tool/pytest/result.py	Wed Jul 13 21:47:54 2005
@@ -89,7 +89,13 @@
             if name in self._reprs: 
                 value = eval(value)  # XXX security
             self._headers[name] = value 
-        self.fspath = py.path.local(self['fspath']) 
+        self.fspath = self['fspath']
+        if self['platform'] == 'win32' and '\\' in self.fspath: 
+            self.testname = self.fspath.split('\\')[-1]
+        else: 
+            self.testname = self.fspath.split('/')[-1]
+        #if sys.platform != 'win32' and '\\' in self.fspath: 
+        #    self.fspath = py.path.local(self['fspath'].replace('\\'
         self.path = path 
     
         payload = msg.get_payload() 
@@ -99,6 +105,11 @@
                 fn = submsg.get_filename() 
                 assert fn
                 self.addnamedtext(fn, submsg.get_payload())
+
+    def ismodifiedtest(self): 
+        # XXX we need proper cross-platform paths! 
+        return 'modified' in self.fspath
+
     def __repr__(self): 
         return '<%s (%s) %r rev=%s>' %(self.__class__.__name__, 
                                   self['outcome'], 



More information about the Pypy-commit mailing list