From f5308aba2d6ca086ca56545267b4c5e1db9a800a Mon Sep 17 00:00:00 2001 From: fijal Date: Sat, 3 Feb 2007 19:52:21 +0100 Subject: [PATCH] [svn r37881] Some other stuff goes private --HG-- branch : trunk --- py/doc/TODO.txt | 8 +++++--- py/test/collect.py | 2 +- py/test/item.py | 14 +++++++------- py/test/session.py | 2 +- py/test/terminal/terminal.py | 3 +-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/py/doc/TODO.txt b/py/doc/TODO.txt index e8b759420..35b6716c3 100644 --- a/py/doc/TODO.txt +++ b/py/doc/TODO.txt @@ -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 :) diff --git a/py/test/collect.py b/py/test/collect.py index f04339ccc..cc1885dcf 100644 --- a/py/test/collect.py +++ b/py/test/collect.py @@ -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): diff --git a/py/test/item.py b/py/test/item.py index b192ae550..05681744a 100644 --- a/py/test/item.py +++ b/py/test/item.py @@ -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 diff --git a/py/test/session.py b/py/test/session.py index 216e2ab69..0776563cb 100644 --- a/py/test/session.py +++ b/py/test/session.py @@ -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) diff --git a/py/test/terminal/terminal.py b/py/test/terminal/terminal.py index 647f7ea2d..cd3a4b611 100644 --- a/py/test/terminal/terminal.py +++ b/py/test/terminal/terminal.py @@ -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