[py-svn] r51565 - in py/branch/event/py/test2: . testing
hpk at codespeak.net
hpk at codespeak.net
Sun Feb 17 19:59:06 CET 2008
Author: hpk
Date: Sun Feb 17 19:59:06 2008
New Revision: 51565
Modified:
py/branch/event/py/test2/collect.py
py/branch/event/py/test2/testing/test_collect.py
Log:
fix Docstrings and clarify some variable naming
Modified: py/branch/event/py/test2/collect.py
==============================================================================
--- py/branch/event/py/test2/collect.py (original)
+++ py/branch/event/py/test2/collect.py Sun Feb 17 19:59:06 2008
@@ -35,13 +35,9 @@
return property(fget)
class Base(object):
- """ Collector instances are iteratively generated
- (through their run() and join() methods)
- and form a tree. attributes::
-
- parent: attribute pointing to the parent collector
- (or None if it is the root collector)
- name: basename of this collector object
+ """ base class for the nodes in the collection tree.
+ Nodes with Children are "Collectors" and leaves
+ are the actual Test Items.
"""
def __init__(self, name, parent=None):
self.name = name
@@ -184,6 +180,15 @@
return self._config.get_collector_trail(self)
class Collector(Base):
+ """
+ Collector instances generate children through
+ their listdir() and join() methods and thus
+ form a tree. attributes::
+
+ parent: attribute pointing to the parent collector
+ (or None if this is the root collector)
+ name: basename of this collector object
+ """
Module = configproperty('Module')
DoctestFile = configproperty('DoctestFile')
Directory = configproperty('Directory')
@@ -205,12 +210,10 @@
raise NotImplementedError("abstract")
def join(self, name):
- """ return a child item for the given name. Usually the
- session feeds the join method with each name obtained
- from ``colitem.run()``. If the return value is None
- it means the ``colitem`` was not able to resolve
- with the given name.
+ """ return a child collector or item for the given name.
+ If the return value is None there is no such child.
"""
+ raise NotImplementedError("abstract")
class FSCollector(Collector):
def __init__(self, fspath, parent=None):
Modified: py/branch/event/py/test2/testing/test_collect.py
==============================================================================
--- py/branch/event/py/test2/testing/test_collect.py (original)
+++ py/branch/event/py/test2/testing/test_collect.py Sun Feb 17 19:59:06 2008
@@ -73,8 +73,8 @@
tmp.ensure("normal", 'test_found.py')
tmp.ensure('test_found.py')
- colitem = py.test2.collect.Directory(tmp)
- items = colitem.listdir()
+ col = py.test2.collect.Directory(tmp)
+ items = col.listdir()
assert len(items) == 2
assert 'normal' in items
assert 'test_found.py' in items
@@ -105,9 +105,9 @@
col = py.test2.collect.Module(setupdata.getexamplefile('disabled.py'))
l = col.listdir()
assert len(l) == 1
- colitem = col.join(l[0])
- assert isinstance(colitem, py.test2.collect.Class)
- assert not colitem.listdir()
+ col = col.join(l[0])
+ assert isinstance(col, py.test2.collect.Class)
+ assert not col.listdir()
def test_disabled_module():
p = setupdata.getexamplefile("disabled_module.py")
More information about the pytest-commit
mailing list