[py-svn] r10701 - in py/branch/py-collect/test: . terminal testing

hpk at codespeak.net hpk at codespeak.net
Fri Apr 15 19:37:48 CEST 2005


Author: hpk
Date: Fri Apr 15 19:37:48 2005
New Revision: 10701

Modified:
   py/branch/py-collect/test/session.py
   py/branch/py-collect/test/terminal/remote.py
   py/branch/py-collect/test/testing/test_session.py
Log:
fix and test determination of interal getrootdir() some more. 



Modified: py/branch/py-collect/test/session.py
==============================================================================
--- py/branch/py-collect/test/session.py	(original)
+++ py/branch/py-collect/test/session.py	Fri Apr 15 19:37:48 2005
@@ -57,7 +57,8 @@
             raise SystemExit, "received external close signal" 
 
         res = capture = None 
-        if not self.config.option.nocapture and isinstance(colitem, py.test.Item):
+        # XXX capturing output even for collectors? 
+        if not self.config.option.nocapture: # and isinstance(colitem, py.test.Item):
             capture = SimpleOutErrCapture() 
         needfinish = False
         try: 

Modified: py/branch/py-collect/test/terminal/remote.py
==============================================================================
--- py/branch/py-collect/test/terminal/remote.py	(original)
+++ py/branch/py-collect/test/terminal/remote.py	Fri Apr 15 19:37:48 2005
@@ -109,7 +109,10 @@
                 break 
             general = x 
         return general 
-    return reduce(generalize, tops) 
+    p =reduce(generalize, tops) 
+    if p.check(file=1): 
+        p = p.dirpath()
+    return p 
 
 def main(config, file, args): 
     """ testing process and output happens at a remote place. """ 

Modified: py/branch/py-collect/test/testing/test_session.py
==============================================================================
--- py/branch/py-collect/test/testing/test_session.py	(original)
+++ py/branch/py-collect/test/testing/test_session.py	Fri Apr 15 19:37:48 2005
@@ -144,7 +144,24 @@
         names = item.listnames()
         assert names == ['ordertest', 'test_orderofexecution.py', 'Testmygroup', '()', 'test_4']
 
-class TestRemoteSession: 
+from py.__impl__.test.terminal.remote import getrootdir 
+class TestRemote: 
+    def test_rootdir_is_package(self): 
+        d = tmpdir.ensure('rootdirtest1', dir=1) 
+        d.ensure('__init__.py')
+        x1 = d.ensure('subdir', '__init__.py')
+        x2 = d.ensure('subdir2', '__init__.py')
+        x3 = d.ensure('subdir3', 'noinit', '__init__.py')
+        assert getrootdir([x1]) == d 
+        assert getrootdir([x2]) == d 
+        assert getrootdir([x1,x2]) == d 
+        assert getrootdir([x3,x2]) == d 
+        assert getrootdir([x2,x3]) == d 
+
+    def test_rootdir_is_not_package(self): 
+        one = tmpdir.ensure('rootdirtest1', 'hello') 
+        rootdir = getrootdir([one]) 
+        assert rootdir == one.dirpath() 
 
     def test_exec(self): 
         o = tmpdir.ensure('remote', dir=1) 



More information about the pytest-commit mailing list