[py-svn] r57834 - in py/trunk/py/test: . testing
hpk at codespeak.net
hpk at codespeak.net
Fri Sep 5 12:07:39 CEST 2008
Author: hpk
Date: Fri Sep 5 12:07:36 2008
New Revision: 57834
Modified:
py/trunk/py/test/pycollect.py
py/trunk/py/test/testing/test_deprecated_api.py
Log:
try to accomodate the fact that some conftests like the Prolog-test ones
subclass Module but do not actually have an underlying python file.
Nowadays, they should subclass "py.test.collect.File".
Modified: py/trunk/py/test/pycollect.py
==============================================================================
--- py/trunk/py/test/pycollect.py (original)
+++ py/trunk/py/test/pycollect.py Fri Sep 5 12:07:36 2008
@@ -149,7 +149,7 @@
class Module(py.test.collect.File, PyCollectorMixin):
def collect(self):
- if getattr(self.obj, 'disabled', 0):
+ if self.fspath.ext == ".py" and getattr(self.obj, 'disabled', 0):
return []
return super(Module, self).collect()
Modified: py/trunk/py/test/testing/test_deprecated_api.py
==============================================================================
--- py/trunk/py/test/testing/test_deprecated_api.py (original)
+++ py/trunk/py/test/testing/test_deprecated_api.py Fri Sep 5 12:07:36 2008
@@ -135,3 +135,20 @@
modcol = self.getmodulecol("def test_some(): pass")
colitems = py.test.deprecated_call(modcol.collect)
funcitem = colitems[0]
+
+ def test_conftest_subclasses_Module_with_non_pyfile(self):
+ self.makepyfile(conftest="""
+ import py
+ class Module(py.test.collect.Module):
+ def run(self):
+ return []
+ class Directory(py.test.collect.Directory):
+ def consider_file(self, path, usefilters=True):
+ if path.basename == "testme.xxx":
+ return Module(path, parent=self)
+ return super(Directory, self).consider_file(path, usefilters=usefilters)
+ """)
+ testme = self._makefile('xxx', testme="hello")
+ config = self.parseconfig(testme)
+ col = config.getfsnode(testme)
+ assert col.collect() == []
More information about the pytest-commit
mailing list