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

hpk at codespeak.net hpk at codespeak.net
Fri Apr 15 20:00:50 CEST 2005


Author: hpk
Date: Fri Apr 15 20:00:50 2005
New Revision: 10705

Modified:
   py/branch/py-collect/test/session.py
   py/branch/py-collect/test/testing/test_collect.py
Log:
fixing and extending the test.  
also turning off stdout/stdin capturing on --pdb 



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 20:00:50 2005
@@ -58,8 +58,9 @@
 
         res = capture = None 
         # XXX capturing output even for collectors? 
-        if not self.config.option.nocapture: # and isinstance(colitem, py.test.Item):
-            capture = SimpleOutErrCapture() 
+        if not self.config.option.nocapture: 
+            if isinstance(colitem, py.test.Item) or not self.config.option.usepdb: 
+                capture = SimpleOutErrCapture() 
         needfinish = False
         try: 
             self.start(colitem)

Modified: py/branch/py-collect/test/testing/test_collect.py
==============================================================================
--- py/branch/py-collect/test/testing/test_collect.py	(original)
+++ py/branch/py-collect/test/testing/test_collect.py	Fri Apr 15 20:00:50 2005
@@ -137,7 +137,7 @@
             pass
         class Directory(py.test.collect.Directory):
             def filefilter(self, fspath):
-                return fspath.check(basestarts='check_')
+                return fspath.check(basestarts='check_', ext='.py')
         class myfuncmixin: 
             Function = MyFunction
             def funcnamefilter(self, name): 
@@ -149,17 +149,20 @@
         class Instance(myfuncmixin, py.test.collect.Instance):
             pass 
         """)
-    o.ensure('somedir', 'check_something.py').write("""if 1:
+    checkfile = o.ensure('somedir', 'check_something.py')
+    checkfile.write("""if 1:
         def check_func():
             assert 42 == 42
         class CustomTestClass:
             def check_method(self):
                 assert 23 == 23
         """)
-    print "tmpdir", tmpdir
-    print "o", o
+
     from py.__impl__.test.collect import getfscollector
-    items = list(getfscollector(o).iteritems())
-    print items
-    assert len(items) == 2
-    assert items[1].__class__.__name__ == 'MyFunction'
+    for x in (o, checkfile, checkfile.dirpath()): 
+        print "checking that %s returns custom items" % (x,) 
+        col = getfscollector(x)
+        items = list(col.iteritems()) 
+        print "col", col
+        assert len(items) == 2
+        assert items[1].__class__.__name__ == 'MyFunction'



More information about the pytest-commit mailing list