/home/johnny/projects/merlinux/py/dist/py/test/session.py:24
def footer(self, colitems):
""" teardown any resources we know about. """
py.test.Function.state.teardown_all()
if not self.config.option.nomagic:
-> py.magic.revoke(assertion=1)
/home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py:163
def footer(self, colitems):
-> super(TerminalSession, self).footer(colitems)
self.endtime = now()
self.out.line()
self.skippedreasons()
self.failures()
self.summaryline()
/home/johnny/projects/merlinux/py/dist/py/test/session.py:52
def main(self, args):
""" main loop for running tests. """
colitems = self._map2colitems(args)
try:
self.header(colitems)
try:
for colitem in colitems:
colitem.option = self.config.option
self.runtraced(colitem)
except KeyboardInterrupt:
raise
except:
self.footer(colitems)
else:
-> self.footer(colitems)
except Exit, ex:
pass
# return [(fspath as string, [names as string])]
return [(str(item.listchain()[0].fspath), item.listnames())
for item, outcome in self.getitemoutcomepairs(py.test.Item.Failed)]
/home/johnny/projects/merlinux/py/dist/py/test/terminal/terminal.py:34
def main(self, args):
if self.config.option._remote:
from py.__.test.terminal import remote
return remote.main(self.config, self._file, self.config._origargs)
else:
-> return super(TerminalSession, self).main(args)
/home/johnny/projects/merlinux/py/dist/py/test/testing/test_collect.py:219
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):
pass
class Directory(py.test.collect.Directory):
def filefilter(self, fspath):
return fspath.check(basestarts='check_', ext='.py')
class myfuncmixin:
Function = MyFunction
def funcnamefilter(self, name):
return name.startswith('check_')
class Module(myfuncmixin, py.test.collect.Module):
def classnamefilter(self, name):
return name.startswith('CustomTestClass')
class Instance(myfuncmixin, py.test.collect.Instance):
pass
""")
checkfile = o.ensure('somedir', 'check_something.py')
checkfile.write("""if 1:
def check_func():
assert 42 == 42
class CustomTestClass:
def check_method(self):
assert 23 == 23
""")
from py.__.test.collect import getfscollector
for x in (o, checkfile, checkfile.dirpath()):
#print "checking that %s returns custom items" % (x,)
col = getfscollector(x)
assert len(list(col.tryiter(py.test.Item))) == 2
#assert items[1].__class__.__name__ == 'MyFunction'
# test that running a session works from the directories
old = o.chdir()
try:
config, args = py.test.Config.parse([])
out = py.std.cStringIO.StringIO()
session = config.getsessionclass()(config, out)
-> session.main(args)
l = session.getitemoutcomepairs(py.test.Item.Passed)
assert len(l) == 2
finally:
old.chdir()
# test that running the file directly works
config, args = py.test.Config.parse([str(checkfile)])
out = py.std.cStringIO.StringIO()
session = config.getsessionclass()(config, out)
session.main(args)
l = session.getitemoutcomepairs(py.test.Item.Passed)
assert len(l) == 2
/home/johnny/projects/merlinux/py/dist/py/test/item.py:79
def execute(self, target, *args):
""" default implementation for calling a test target is to
simply call it.
"""
-> target(*args)
/home/johnny/projects/merlinux/py/dist/py/test/item.py:73
def run(self):
self.state.prepare(self)
-> self.execute(self.obj, *self.args)
/home/johnny/projects/merlinux/py/dist/py/test/rsession/executor.py:22
def execute(self):
try:
-> self.item.run()
outcome = Outcome()
except py.test.Item.Skipped, e:
outcome = Outcome(skipped=str(e))
except (KeyboardInterrupt, SystemExit):
raise
except:
excinfo = py.code.ExceptionInfo()
if isinstance(self.item, py.test.Function):
fun = self.item.obj # hope this is stable
code = py.code.Code(fun)
excinfo.traceback = excinfo.traceback.cut(
path=code.path, firstlineno=code.firstlineno)
outcome = Outcome(excinfo=excinfo, setupfailure=False)
if self.usepdb:
if self.reporter is not None:
self.reporter(report.ImmediateFailure(self.item,
ReprOutcome(outcome.make_repr())))
import pdb
pdb.post_mortem(excinfo._excinfo[2])
# XXX hmm, we probably will not like to continue from that point
# or we do?
raise SystemExit()
outcome.stdout = ""
outcome.stderr = ""
return outcome
/home/johnny/projects/merlinux/py/dist/py/test/rsession/local.py:31
def plain_runner(item, session, reporter):
# box executor is doing stdout/err catching for us, let's do it here
startcapture(session)
r = RunExecutor(item, usepdb=session.config.option.usepdb, reporter=reporter)
-> outcome = r.execute()
outcome = ReprOutcome(outcome.make_repr())
outcome.stdout, outcome.stderr = finishcapture(session)
return outcome
/home/johnny/projects/merlinux/py/dist/py/test/rsession/local.py:47
def apigen_runner(item, session, reporter):
r = RunExecutor(item, reporter=reporter)
session.tracer.start_tracing()
-> retval = plain_runner(item, session, reporter)
session.tracer.end_tracing()
return retval