diff --git a/py/__init__.py b/py/__init__.py index e3ec40df3..a3c1d0b37 100644 --- a/py/__init__.py +++ b/py/__init__.py @@ -9,8 +9,8 @@ version = "0.9.0-beta" initpkg(__name__, description = "py lib: agile development and test support library", - revision = int('$LastChangedRevision: 38598 $'.split(':')[1][:-1]), - lastchangedate = '$LastChangedDate: 2007-02-12 17:57:45 +0100 (Mon, 12 Feb 2007) $', + revision = int('$LastChangedRevision: 38747 $'.split(':')[1][:-1]), + lastchangedate = '$LastChangedDate: 2007-02-13 20:21:53 +0100 (Tue, 13 Feb 2007) $', version = version, url = "http://codespeak.net/py", download_url = "http://codespeak.net/download/py/py-%s.tar.gz" %(version,), @@ -43,8 +43,8 @@ initpkg(__name__, 'test.collect.Class' : ('./test/collect.py', 'Class'), 'test.collect.Instance' : ('./test/collect.py', 'Instance'), 'test.collect.Generator' : ('./test/collect.py', 'Generator'), - 'test.Item' : ('./test/item.py', 'Item'), - 'test.Function' : ('./test/item.py', 'Function'), + 'test.collect.Item' : ('./test/item.py', 'Item'), + 'test.collect.Function' : ('./test/item.py', 'Function'), # thread related API (still in early design phase) '_thread.WorkerPool' : ('./thread/pool.py', 'WorkerPool'), diff --git a/py/doc/conftest.py b/py/doc/conftest.py index 8a29265e4..bbdb7e1ba 100644 --- a/py/doc/conftest.py +++ b/py/doc/conftest.py @@ -87,13 +87,13 @@ def _checkskip(lpath): py.test.skip("html file is up to date, use --forcegen to regenerate") #return [] # no need to rebuild -class ReSTSyntaxTest(py.test.Item): +class ReSTSyntaxTest(py.test.collect.Item): def run(self): mypath = self.fspath _checkskip(mypath) restcheck(py.path.svnwc(mypath)) -class DoctestText(py.test.Item): +class DoctestText(py.test.collect.Item): def run(self): # XXX quite nasty... but it works (fixes win32 issues) s = self._normalize_linesep() @@ -141,7 +141,7 @@ class LinkCheckerMaker(py.test.collect.Collector): if tryfn == name: return CheckLink(name, parent=self, args=(tryfn, path, lineno), obj=call) -class CheckLink(py.test.Function): +class CheckLink(py.test.collect.Function): def setup(self): pass def teardown(self): diff --git a/py/doc/impl-test.txt b/py/doc/impl-test.txt index 1ce66fe9f..b4e22a750 100644 --- a/py/doc/impl-test.txt +++ b/py/doc/impl-test.txt @@ -254,7 +254,7 @@ serve some immediate purposes like paramtrized tests. The other extension possibility goes deeper into the machinery and allows you to specify a custom test ``Item`` class which is responsible for setting up and executing an underlying -test. [XXX not working: You can integrate your custom ``py.test.Item`` subclass +test. [XXX not working: You can integrate your custom ``py.test.collect.Item`` subclass by binding an ``Item`` name to a test class.] Or you can extend the collection process for a whole directory tree by putting Items in a ``conftest.py`` configuration file. diff --git a/py/test/collect.py b/py/test/collect.py index 40198e3f0..55ec9ee05 100644 --- a/py/test/collect.py +++ b/py/test/collect.py @@ -198,7 +198,7 @@ class Collector(object): cases. """ if yieldtype is None: - yieldtype = py.test.Item + yieldtype = py.test.collect.Item if isinstance(self, yieldtype): try: self._skipbykeyword(keyword) @@ -208,7 +208,7 @@ class Collector(object): excinfo = py.code.ExceptionInfo() reporterror((excinfo, self)) else: - if not isinstance(self, py.test.Item): + if not isinstance(self, py.test.collect.Item): try: if reporterror is not None: reporterror((None, self)) @@ -431,7 +431,7 @@ class Class(PyCollectorMixin, Collector): except IOError: pass # fall back... - for x in self._tryiter((py.test.collect.Generator, py.test.Item)): + for x in self._tryiter((py.test.collect.Generator, py.test.collect.Item)): return x._getsortvalue() class Instance(PyCollectorMixin, Collector): diff --git a/py/test/defaultconftest.py b/py/test/defaultconftest.py index 300585a91..e3f3e2dc2 100644 --- a/py/test/defaultconftest.py +++ b/py/test/defaultconftest.py @@ -5,7 +5,7 @@ DoctestFile = py.test.collect.DoctestFile Directory = py.test.collect.Directory Class = py.test.collect.Class Generator = py.test.collect.Generator -Function = py.test.Function +Function = py.test.collect.Function Instance = py.test.collect.Instance conf_iocapture = "fd" # overridable from conftest.py diff --git a/py/test/doctest.py b/py/test/doctest.py index b4986f016..c2df712da 100644 --- a/py/test/doctest.py +++ b/py/test/doctest.py @@ -1,6 +1,6 @@ import py -class DoctestText(py.test.Item): +class DoctestText(py.test.collect.Item): def _setcontent(self, content): self._content = content diff --git a/py/test/representation.py b/py/test/representation.py index 619c2225d..73d300f80 100644 --- a/py/test/representation.py +++ b/py/test/representation.py @@ -40,7 +40,7 @@ class Presenter(object): self.out.line(prefix + source[i]) def repr_item_info(self, item): - """ This method represents py.test.Item info (path and module) + """ This method represents py.test.collect.Item info (path and module) """ root = item.fspath modpath = item._getmodpath() diff --git a/py/test/rsession/executor.py b/py/test/rsession/executor.py index bb30af6ae..7fbf81823 100644 --- a/py/test/rsession/executor.py +++ b/py/test/rsession/executor.py @@ -44,7 +44,7 @@ class RunExecutor(object): excinfo = e.excinfo else: excinfo = py.code.ExceptionInfo() - if isinstance(self.item, py.test.Function): + if isinstance(self.item, py.test.collect.Function): fun = self.item.obj # hope this is stable code = py.code.Code(fun) excinfo.traceback = excinfo.traceback.cut( @@ -82,7 +82,7 @@ class ApigenExecutor(RunExecutor): """ We want to trace *only* function objects here. Unsure what to do with custom collectors at all """ - if hasattr(self.item, 'obj') and type(self.item) is py.test.Function: + if hasattr(self.item, 'obj') and type(self.item) is py.test.collect.Function: self.item.execute = self.wrap_underlaying self.item.run() diff --git a/py/test/rsession/repevent.py b/py/test/rsession/repevent.py index 0a2ed3a93..7fa8adcc3 100644 --- a/py/test/rsession/repevent.py +++ b/py/test/rsession/repevent.py @@ -11,7 +11,7 @@ def basic_report(msg_type, message): # pass ##def report_error(excinfo): -## if isinstance(excinfo, py.test.Item.Skipped): +## if isinstance(excinfo, py.test.collect.Item.Skipped): ## # we need to dispatch this info ## report(Skipped(excinfo)) ## else: diff --git a/py/test/rsession/testing/test_executor.py b/py/test/rsession/testing/test_executor.py index 13f15bfa1..3e5490e9a 100644 --- a/py/test/rsession/testing/test_executor.py +++ b/py/test/rsession/testing/test_executor.py @@ -12,7 +12,7 @@ def setup_module(mod): if py.std.sys.platform == "win32": py.test.skip("skipping executor tests (some require os.fork)") -class Item(py.test.Item): +class Item(py.test.collect.Item): def __init__(self, name, config): super(Item, self).__init__(name) self._config = config diff --git a/py/test/rsession/testing/test_master.py b/py/test/rsession/testing/test_master.py index fb7566eba..d03c787ef 100644 --- a/py/test/rsession/testing/test_master.py +++ b/py/test/rsession/testing/test_master.py @@ -49,7 +49,7 @@ class NonWorkingChannel(object): def _getremoteerror(self): return "blah" -class Item(py.test.Item): +class Item(py.test.collect.Item): def _get_collector_trail(self): return (self.name,) diff --git a/py/test/session.py b/py/test/session.py index 0776563cb..556ac3289 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.collect.Function._state.teardown_all() if not self.config.option.nomagic: py.magic.revoke(assertion=1) @@ -99,9 +99,9 @@ class Session(object): colitem.finishcapture() def run(self, colitem): - if self.config.option.collectonly and isinstance(colitem, py.test.Item): + if self.config.option.collectonly and isinstance(colitem, py.test.collect.Item): return - if isinstance(colitem, py.test.Item): + if isinstance(colitem, py.test.collect.Item): colitem._skipbykeyword(self.config.option.keyword) res = colitem.run() if res is None: diff --git a/py/test/terminal/terminal.py b/py/test/terminal/terminal.py index 3a3a46816..2d7e09b04 100644 --- a/py/test/terminal/terminal.py +++ b/py/test/terminal/terminal.py @@ -75,7 +75,7 @@ class TerminalSession(Session): def start_Item(self, colitem): if self.config.option.verbose >= 1: - if isinstance(colitem, py.test.Item): + if isinstance(colitem, py.test.collect.Item): realpath, lineno = colitem._getpathlineno() location = "%s:%d" % (realpath.basename, lineno+1) self.out.write("%-20s %s " % (location, colitem._getmodpath())) @@ -100,7 +100,7 @@ class TerminalSession(Session): resultstring = self.repr_progress_module_result(colitem, outcome) if resultstring: self.out.line(" - " + resultstring) - if isinstance(colitem, py.test.Item): + if isinstance(colitem, py.test.collect.Item): if self.config.option.verbose >= 1: resultstring = self.repr_progress_long_result(colitem, outcome) resultstring += " (%.2f)" % (colitem.elapsedtime,) diff --git a/py/test/testing/test_collect.py b/py/test/testing/test_collect.py index 695d8c7d4..1f2251bbb 100644 --- a/py/test/testing/test_collect.py +++ b/py/test/testing/test_collect.py @@ -109,7 +109,7 @@ class Testsomeclass: #class TestWithCustomItem: -# class Item(py.test.Item): +# class Item(py.test.collect.Item): # flag = [] # def execute(self, target, *args): # self.flag.append(42) @@ -146,8 +146,8 @@ def test_generative_simple(): l2 = generator.run() assert len(l2) == 2 l2 = generator.multijoin(l2) - assert isinstance(l2[0], py.test.Function) - assert isinstance(l2[1], py.test.Function) + assert isinstance(l2[0], py.test.collect.Function) + assert isinstance(l2[1], py.test.collect.Function) assert l2[0].name == '[0]' assert l2[1].name == '[1]' @@ -162,8 +162,8 @@ def test_generative_simple(): l2 = generator.run() assert len(l2) == 2 l2 = generator.multijoin(l2) - assert isinstance(l2[0], py.test.Function) - assert isinstance(l2[1], py.test.Function) + assert isinstance(l2[0], py.test.collect.Function) + assert isinstance(l2[1], py.test.collect.Function) assert l2[0].name == '[0]' assert l2[1].name == '[1]' @@ -171,7 +171,7 @@ def test_custom_python_collection_from_conftest(): o = tmpdir.ensure('customconfigtest', dir=1) o.ensure('conftest.py').write("""if 1: import py - class MyFunction(py.test.Function): + class MyFunction(py.test.collect.Function): pass class Directory(py.test.collect.Directory): def filefilter(self, fspath): @@ -200,7 +200,7 @@ def test_custom_python_collection_from_conftest(): config = py.test.config._reparse([x]) #print "checking that %s returns custom items" % (x,) col = config._getcollector(x) - assert len(list(col._tryiter(py.test.Item))) == 2 + assert len(list(col._tryiter(py.test.collect.Item))) == 2 #assert items[1].__class__.__name__ == 'MyFunction' # test that running a session works from the directories @@ -227,7 +227,7 @@ def test_custom_NONpython_collection_from_conftest(): o = tmpdir.ensure('customconfigtest_nonpython', dir=1) o.ensure('conftest.py').write("""if 1: import py - class CustomItem(py.test.Item): + class CustomItem(py.test.collect.Item): def run(self): pass @@ -247,7 +247,7 @@ def test_custom_NONpython_collection_from_conftest(): print "checking that %s returns custom items" % (x,) config = py.test.config._reparse([x]) col = config._getcollector(x) - assert len(list(col._tryiter(py.test.Item))) == 1 + assert len(list(col._tryiter(py.test.collect.Item))) == 1 #assert items[1].__class__.__name__ == 'MyFunction' # test that running a session works from the directories @@ -337,7 +337,7 @@ def test_documentation_virtual_collector_interaction(): try: conf.option.forcegen = 1 col = py.test.collect.Directory(rootdir) - x = list(col._tryiter(yieldtype=py.test.Function)) + x = list(col._tryiter(yieldtype=py.test.collect.Function)) finally: conf.option.forcegen = old diff --git a/py/test/testing/test_doctest.py b/py/test/testing/test_doctest.py index f61ce1ce1..bd44a559b 100644 --- a/py/test/testing/test_doctest.py +++ b/py/test/testing/test_doctest.py @@ -37,7 +37,7 @@ def test_collect_doctest_files_with_test_prefix(): #print "checking that %s returns custom items" % (x,) config = py.test.config._reparse([x]) col = config._getcollector(x) - items = list(col._tryiter(py.test.Item)) + items = list(col._tryiter(py.test.collect.Item)) assert len(items) == 1 assert isinstance(items[0], DoctestText) diff --git a/py/test/testing/test_session.py b/py/test/testing/test_session.py index 013d185c9..42cf8d2d9 100644 --- a/py/test/testing/test_session.py +++ b/py/test/testing/test_session.py @@ -192,7 +192,7 @@ class TestTerminalSession: """)) conftest = o.join('conftest.py').write(py.code.Source(""" import py - class Function(py.test.Function): + class Function(py.test.collect.Function): def startcapture(self): self._mycapture = None