[py-svn] r37229 - py/branch/config/py/test
hpk at codespeak.net
hpk at codespeak.net
Tue Jan 23 20:38:28 CET 2007
Author: hpk
Date: Tue Jan 23 20:38:27 2007
New Revision: 37229
Modified:
py/branch/config/py/test/collect.py
py/branch/config/py/test/session.py
Log:
not sure why this code was duplicated at all?
(seems so easy to avoid it)
Modified: py/branch/config/py/test/collect.py
==============================================================================
--- py/branch/config/py/test/collect.py (original)
+++ py/branch/config/py/test/collect.py Tue Jan 23 20:38:27 2007
@@ -190,8 +190,10 @@
newl.append(x.name)
return ".".join(newl)
- # XXX: Copied from session
def skipbykeyword(self, keyword):
+ """ raise Skipped() exception if the given keyword
+ matches for this collector.
+ """
if not keyword:
return
chain = self.listchain()
Modified: py/branch/config/py/test/session.py
==============================================================================
--- py/branch/config/py/test/session.py (original)
+++ py/branch/config/py/test/session.py Tue Jan 23 20:38:27 2007
@@ -91,7 +91,7 @@
if self.config.option.collectonly and isinstance(colitem, py.test.Item):
return
if isinstance(colitem, py.test.Item):
- self.skipbykeyword(colitem)
+ colitem.skipbykeyword(self.config.option.keyword)
res = colitem.run()
if res is None:
return py.test.Item.Passed()
@@ -110,24 +110,6 @@
finish()
return res
- def skipbykeyword(self, colitem):
- keyword = self.config.option.keyword
- if not keyword:
- return
- chain = colitem.listchain()
- for key in filter(None, keyword.split()):
- eor = key[:1] == '-'
- if eor:
- key = key[1:]
- if not (eor ^ self._matchonekeyword(key, chain)):
- py.test.skip("test not selected by keyword %r" %(keyword,))
-
- def _matchonekeyword(self, key, chain):
- for subitem in chain:
- if subitem.haskeyword(key):
- return True
- return False
-
class Exit(Exception):
""" for immediate program exits without tracebacks and reporter/summary. """
def __init__(self, msg="unknown reason", item=None):
More information about the pytest-commit
mailing list