[py-svn] r30556 - in py/dist/py/test: . testing

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Jul 26 11:34:50 CEST 2006


Author: cfbolz
Date: Wed Jul 26 11:34:48 2006
New Revision: 30556

Modified:
   py/dist/py/test/collect.py
   py/dist/py/test/testing/test_session.py
Log:
make keywords match the test name using 'keyword in name', instead of
'name.startswith(keyword)'.


Modified: py/dist/py/test/collect.py
==============================================================================
--- py/dist/py/test/collect.py	(original)
+++ py/dist/py/test/collect.py	Wed Jul 26 11:34:48 2006
@@ -148,7 +148,7 @@
         return [x.name for x in self.listchain()]
 
     def haskeyword(self, keyword): 
-        return self.name.startswith(keyword)
+        return keyword in self.name
 
     def getmodpath(self):
         """ return dotted module path (relative to the containing). """ 

Modified: py/dist/py/test/testing/test_session.py
==============================================================================
--- py/dist/py/test/testing/test_session.py	(original)
+++ py/dist/py/test/testing/test_session.py	Wed Jul 26 11:34:48 2006
@@ -42,15 +42,16 @@
 
 class TestKeywordSelection: 
     def test_select_simple(self): 
-        config, args = py.test.Config.parse(['-k', 'test_one'])
-        session = config.getsessionclass()(config, py.std.sys.stdout)
-        session.main([datadir / 'filetest.py'])
-        l = session.getitemoutcomepairs(py.test.Item.Failed)
-        assert len(l) == 1 
-        item = l[0][0]
-        assert item.name == 'test_one'
-        l = session.getitemoutcomepairs(py.test.Item.Skipped)
-        assert len(l) == 1 
+        for keyword in ['test_one', 'est_on']:
+            config, args = py.test.Config.parse(['-k', keyword])
+            session = config.getsessionclass()(config, py.std.sys.stdout)
+            session.main([datadir / 'filetest.py'])
+            l = session.getitemoutcomepairs(py.test.Item.Failed)
+            assert len(l) == 1 
+            item = l[0][0]
+            assert item.name == 'test_one'
+            l = session.getitemoutcomepairs(py.test.Item.Skipped)
+            assert len(l) == 1 
 
     def test_select_extra_keywords(self): 
         o = tmpdir.ensure('selecttest', dir=1)



More information about the pytest-commit mailing list