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

View File

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

View File

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

View File

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

View File

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