[svn r37881] Some other stuff goes private

--HG--
branch : trunk
This commit is contained in:
fijal 2007-02-03 19:52:21 +01:00
parent f9b8a810cd
commit f5308aba2d
5 changed files with 15 additions and 14 deletions

View File

@ -78,7 +78,7 @@ APIGEN / source viewer
with help code from py.__.rest.directive....
make sure that the txt files in py/documentation/ use it
* private py.test not-meant-to-be-public API:
* (DONE) private py.test not-meant-to-be-public API:
here is a rough list what we want public on collectors:
py.test.collect.Collector.
@ -90,15 +90,17 @@ APIGEN / source viewer
listnames()
run()
join()
multijoin()
name, parent, fspath
* all collector class properties *
and on py.test.Function|Item (which also has the collector interface):
execute()
move all Outcome (Skipped/Passed/...) classes to
DONE move all Outcome (Skipped/Passed/...) classes to
a global place (outcome.py?)
all other attributes of collectors shall become private
DONE all other attributes of collectors shall become private
* after the above API cleanup there might be more :)

View File

@ -457,7 +457,7 @@ class Generator(PyCollectorMixin, Collector):
d = {}
# slightly hackish to invoke setup-states on
# collection ...
self.Function.state.prepare(self)
self.Function._state.prepare(self)
for i, x in py.builtin.enumerate(self.obj()):
call, args = self.getcallargs(x)
if not callable(call):

View File

@ -46,13 +46,13 @@ class Function(Item):
""" a Function Item is responsible for setting up
and executing a Python callable test object.
"""
state = SetupState()
_state = SetupState()
def __init__(self, name, parent, args=(), obj=_dummy, sort_value = None):
super(Function, self).__init__(name, parent)
self.args = args
self._args = args
if obj is not _dummy:
self._obj = obj
self.sort_value = sort_value
self._sort_value = sort_value
def __repr__(self):
return "<%s %r>" %(self.__class__.__name__, self.name)
@ -62,13 +62,13 @@ class Function(Item):
return code.path, code.firstlineno
def _getsortvalue(self):
if self.sort_value is None:
if self._sort_value is None:
return self._getpathlineno()
return self.sort_value
return self._sort_value
def run(self):
self.state.prepare(self)
self.execute(self.obj, *self.args)
self._state.prepare(self)
self.execute(self.obj, *self._args)
def execute(self, target, *args):
""" default implementation for calling a test target is to

View File

@ -20,7 +20,7 @@ class Session(object):
def footer(self, colitems):
""" teardown any resources after a test run. """
py.test.Function.state.teardown_all()
py.test.Function._state.teardown_all()
if not self.config.option.nomagic:
py.magic.revoke(assertion=1)

View File

@ -1,7 +1,6 @@
import py
from time import time as now
Item = py.test.Item
from py.__.test.terminal.out import getout
from py.__.test.representation import Presenter
from py.__.test.outcome import Skipped, Passed, Failed
@ -91,7 +90,7 @@ class TerminalSession(Session):
return
colitem.elapsedtime = end - colitem.start
if self.config.option.usepdb:
if isinstance(outcome, Item.Failed):
if isinstance(outcome, Failed):
print "dispatching to ppdb", colitem
self.repr_failure(colitem, outcome)
import pdb