[svn r38747] hum, a last-minute namespace change: i missed
that fijal didn't move py.test.Item|Function to the py.test.collect namespace at the time. a pypy fix will follow shortly after i merged the dist. --HG-- branch : trunk
This commit is contained in:
parent
1bddcfee3d
commit
3ab95e5672
|
@ -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'),
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import py
|
||||
|
||||
class DoctestText(py.test.Item):
|
||||
class DoctestText(py.test.collect.Item):
|
||||
|
||||
def _setcontent(self, content):
|
||||
self._content = content
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue