Python中的调试:显示最后N行执行的代码
我希望看到python解释器在发生此异常之前执行的最后10行:Python中的调试:显示最后N行执行的代码,python,debugging,pycharm,Python,Debugging,Pycharm,我希望看到python解释器在发生此异常之前执行的最后10行: test_has_perm_in_foobar.py F Traceback (most recent call last): File "/.../test_has_perm_in_foobar.py", line 50, in test_has_perm self.assertFalse(check_perm(request, some_object)) File "/usr/lib/python2.7/unit
test_has_perm_in_foobar.py F
Traceback (most recent call last):
File "/.../test_has_perm_in_foobar.py", line 50, in test_has_perm
self.assertFalse(check_perm(request, some_object))
File "/usr/lib/python2.7/unittest/case.py", line 416, in assertFalse
raise self.failureException(msg)
AssertionError: True is not false
我想看看哪里check\u perm()
返回了True
我知道我可以使用交互式调试来查找匹配的行,但我很懒,希望找到一种更简单的方法来查找check\u perm()
返回返回值的行
我使用pyCharm,但基于文本的工具也能解决我的需要
顺便说一句:请不要告诉我如何使用带有单步跳过和单步进入的调试器。我知道这一点
下面是一些代码来说明它
def check_perm(request, some_object):
if condition_1:
return True
if condition_2:
return sub_check(some_object)
if condition_3:
return sub_check2(some_object)
...
有几种方法可以让check\u perm()
返回True
。如果由于条件_1而返回了True
,那么我希望看到类似的情况
+ if condition_1:
+ return True
我心目中的输出类似于shell上的set-x
更新
cgib、pytest和其他工具可以显示断言失败的行之前的行。但是,它们只显示当前python文件的行。这个问题是关于在断言发生之前执行的行,但涵盖所有文件。在我的例子中,我想知道check\u perm()
的返回值是在哪里创建的。pytest、cgitb等工具。。。不要展示这个
我正在搜索的是shell上的set-x
:
帮助设置
-x打印命令及其执行时的参数
那么cgitb如何?您只需要将此模块导入到代码中
import cgitb
cgitb.enable(format='text')
def f():
a = 1
b = 2
c = 3
x = 0
d = a * b * c / x
return d
if __name__ == "__main__":
f()
给出:
ZeroDivisionError
Python 3.5.2: /usr/bin/python3
Mon Dec 19 17:42:34 2016
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
/home/user1/123.py in <module>()
10 d = a * b * c / x
11 return x
12
13 if __name__ == "__main__":
14 f()
f = <function f>
/home/user1/123.py in f()
8 c = 3
9 x = 0
10 d = a * b * c / x
11 return x
12
d undefined
a = 1
b = 2
c = 3
x = 0
ZeroDivisionError: division by zero
...
The above is a description of an error in a Python program. Here is
the original traceback:
Traceback (most recent call last):
File "123.py", line 14, in <module>
f()
File "123.py", line 10, in f
d = a * b * c / x
ZeroDivisionError: division by zero
zero错误
Python 3.5.2:/usr/bin/python3
2016年12月19日星期一17:42:34
Python脚本中出现问题。下面是一系列的步骤
导致错误的函数调用,按发生顺序排列。
/home/user1/123.py in()
10 d=a*b*c/x
11返回x
12
13如果名称=“\uuuuu main\uuuuuuuu”:
14 f()
f=
/f()中的home/user1/123.py
8 c=3
9 x=0
10 d=a*b*c/x
11返回x
12
d未定义
a=1
b=2
c=3
x=0
ZeroDivision错误:被零除
...
上面是Python程序中错误的描述。这是
原始回溯:
回溯(最近一次呼叫最后一次):
文件“123.py”,第14行,在
f()
文件“123.py”,第10行,在f中
d=a*b*c/x
ZeroDivision错误:被零除
由于找不到解决方案,我自己写了以下内容:
with trace_function_calls():
self.assertFalse(check_perm(request, some_object))
跟踪函数调用()的实现:
PS:这是开源软件。如果你想创建一个python包,那么就去做吧,告诉我,这会让我很高兴。出于这个原因,我把测试切换到了 它可以显示局部变量,并以不同的去目标化水平进行回溯。完成调用的行标记为
例如,在我的django项目中:
$ py.test --showlocals --tb=long
=============================== test session starts ===============================
platform darwin -- Python 3.5.1, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
Django settings: dj_tg_bot.settings (from ini file)
rootdir: /Users/el/Projects/dj-tg-alpha-bot, inifile: tox.ini
plugins: django-3.0.0, cov-2.4.0
collected 8 items
tests/test_commands.py ....F
tests/test_logger.py .
tests/test_simple.py ..
==================================== FAILURES =====================================
__________________________ TestSimpleCommands.test_start __________________________
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
def test_start(self,):
"""
Test bot accept normally command /start and replies as it should.
"""
> self._test_message_ok(self.start)
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
tests/test_commands.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
action = {'in': ' /start', 'out': {'parse_mode': 'Markdown', 'reply_markup': '', 'text': 'Welcome'}}
update = <telegram.update.Update object at 0x113e16cf8>, number = 1
def _test_message_ok(self, action, update=None, number=1):
if not update:
update = self.update
with mock.patch("telegram.bot.Bot.sendMessage", callable=mock.MagicMock()) as mock_send:
if 'in' in action:
update.message.text = action['in']
response = self.client.post(self.webhook_url, update.to_json(), **self.kwargs)
# Check response 200 OK
self.assertEqual(response.status_code, status.HTTP_200_OK)
# Check
> self.assertBotResponse(mock_send, action)
action = {'in': ' /start', 'out': {'parse_mode': 'Markdown', 'reply_markup': '', 'text': 'Welcome'}}
mock_send = <MagicMock name='sendMessage' id='4619939344'>
number = 1
response = <Response status_code=200, "application/json">
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
update = <telegram.update.Update object at 0x113e16cf8>
../../.pyenv/versions/3.5.1/lib/python3.5/site-packages/telegrambot/test/testcases.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
mock_send = <MagicMock name='sendMessage' id='4619939344'>
command = {'in': ' /start', 'out': {'parse_mode': 'Markdown', 'reply_markup': '', 'text': 'Welcome'}}
def assertBotResponse(self, mock_send, command):
> args, kwargs = mock_send.call_args
E TypeError: 'NoneType' object is not iterable
command = {'in': ' /start', 'out': {'parse_mode': 'Markdown', 'reply_markup': '', 'text': 'Welcome'}}
mock_send = <MagicMock name='sendMessage' id='4619939344'>
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
../../.pyenv/versions/3.5.1/lib/python3.5/site-packages/telegrambot/test/testcases.py:61: TypeError
------------------------------ Captured stderr call -------------------------------
Handler not found for {'message': {'from': {'username': 'username_4', 'last_name': 'last_name_4', 'id': 5, 'first_name': 'first_name_4'}, 'chat': {'username': 'username_4', 'last_name': 'last_name_4', 'first_name': 'first_name_4', 'title': 'title_4', 'type': 'private', 'id': 5}, 'text': ' /start', 'message_id': 5, 'date': 1482500826}, 'update_id': 5}
======================= 1 failed, 7 passed in 2.29 seconds ========================
(.env) ✘-1 ~/Projects/dj-tg-alpha-bot [master|✚ 1…8⚑ 12]
16:47 $
$py.test--showlocals--tb=long
==============================================测试会话开始===============================
平台darwin——Python 3.5.1、pytest-3.0.3、py-1.4.31、Plugy-0.4.0
Django设置:dj_tg_bot.settings(来自ini文件)
rootdir:/Users/el/Projects/dj-tg-alpha-bot,ini文件:tox.ini
插件:django-3.0.0、cov-2.4.0
收集了8个项目
tests/test_commands.py…F
测试/test_logger.py。
测试/测试_simple.py。。
======================================================故障=====================================
__________________________TestSimpleCommand.test\u启动__________________________
自我=
def测试_启动(自)
"""
测试bot正常接受命令/启动,并按其应该的方式回复。
"""
>self.\u测试\u消息\u正常(self.start)
自我=
测试/测试_命令。py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
自我=
action={'in':'/start','out':{'parse_mode':'Markdown','reply_markup':'','text':'Welcome'}
更新=,编号=1
def _测试_消息_ok(自我、操作、更新=无,编号=1):
如果没有更新:
update=self.update
使用mock.patch(“telegram.bot.bot.sendMessage”,callable=mock.MagicMock())作为mock_发送:
如果“正在”运行:
update.message.text=操作['in']
response=self.client.post(self.webhook_url,update.to_json(),**self.kwargs)
#检查响应200 OK
self.assertEqual(response.status\u代码,status.HTTP\u 200\u OK)
#检查
>self.assertBotResponse(模拟发送,操作)
action={'in':'/start','out':{'parse_mode':'Markdown','reply_markup':'','text':'Welcome'}
模拟发送=
数字=1
答复=
自我=
更新=
../../.pyenv/versions/3.5.1/lib/python3.5/site packages/telegrambot/test/testcases.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
自我=
模拟发送=
command={'in':'/start','out':{'parse_mode':'Markdown','reply_markup':'','text':'Welcome'}
def assertBotResponse(自我、模拟发送、命令):
>args,kwargs=mock\u send.call\u args
E类型错误:“非类型”对象不可编辑
command={'in':'/start','out':{'parse_mode':'Markdown','reply_markup':'','text':'Welcome'}
模拟发送=
自我=
../...pyenv/versions/3.5.1/lib/python3.5/site packages/telegrambot/test/testcases.py:61:TypeError
------------------------------捕获的stderr调用-------------------------------
未找到{'message':{'from':{'username':'username\u 4','last\u name':'last\u name\u 4','id':5','first\u name':'first\u name\u 4',chat':{'username':'username\u 4','first\u name':'first\u name\u 4','title':'title':'title\u 4','type':'private','id':5},'text':'start','message id':5',date 2500826},“更新id”:5}
==================================1失败,2.29秒内通过7次========================
(.env)✘-1~/Projects/dj tg阿尔法机器人[主|✚ 1…8⚑ 12]
16:47 $
模块具有与bourne兼容的外壳set-x
类似的功能
$ py.test --showlocals --tb=long
=============================== test session starts ===============================
platform darwin -- Python 3.5.1, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
Django settings: dj_tg_bot.settings (from ini file)
rootdir: /Users/el/Projects/dj-tg-alpha-bot, inifile: tox.ini
plugins: django-3.0.0, cov-2.4.0
collected 8 items
tests/test_commands.py ....F
tests/test_logger.py .
tests/test_simple.py ..
==================================== FAILURES =====================================
__________________________ TestSimpleCommands.test_start __________________________
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
def test_start(self,):
"""
Test bot accept normally command /start and replies as it should.
"""
> self._test_message_ok(self.start)
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
tests/test_commands.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
action = {'in': ' /start', 'out': {'parse_mode': 'Markdown', 'reply_markup': '', 'text': 'Welcome'}}
update = <telegram.update.Update object at 0x113e16cf8>, number = 1
def _test_message_ok(self, action, update=None, number=1):
if not update:
update = self.update
with mock.patch("telegram.bot.Bot.sendMessage", callable=mock.MagicMock()) as mock_send:
if 'in' in action:
update.message.text = action['in']
response = self.client.post(self.webhook_url, update.to_json(), **self.kwargs)
# Check response 200 OK
self.assertEqual(response.status_code, status.HTTP_200_OK)
# Check
> self.assertBotResponse(mock_send, action)
action = {'in': ' /start', 'out': {'parse_mode': 'Markdown', 'reply_markup': '', 'text': 'Welcome'}}
mock_send = <MagicMock name='sendMessage' id='4619939344'>
number = 1
response = <Response status_code=200, "application/json">
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
update = <telegram.update.Update object at 0x113e16cf8>
../../.pyenv/versions/3.5.1/lib/python3.5/site-packages/telegrambot/test/testcases.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
mock_send = <MagicMock name='sendMessage' id='4619939344'>
command = {'in': ' /start', 'out': {'parse_mode': 'Markdown', 'reply_markup': '', 'text': 'Welcome'}}
def assertBotResponse(self, mock_send, command):
> args, kwargs = mock_send.call_args
E TypeError: 'NoneType' object is not iterable
command = {'in': ' /start', 'out': {'parse_mode': 'Markdown', 'reply_markup': '', 'text': 'Welcome'}}
mock_send = <MagicMock name='sendMessage' id='4619939344'>
self = <tests.test_commands.TestSimpleCommands testMethod=test_start>
../../.pyenv/versions/3.5.1/lib/python3.5/site-packages/telegrambot/test/testcases.py:61: TypeError
------------------------------ Captured stderr call -------------------------------
Handler not found for {'message': {'from': {'username': 'username_4', 'last_name': 'last_name_4', 'id': 5, 'first_name': 'first_name_4'}, 'chat': {'username': 'username_4', 'last_name': 'last_name_4', 'first_name': 'first_name_4', 'title': 'title_4', 'type': 'private', 'id': 5}, 'text': ' /start', 'message_id': 5, 'date': 1482500826}, 'update_id': 5}
======================= 1 failed, 7 passed in 2.29 seconds ========================
(.env) ✘-1 ~/Projects/dj-tg-alpha-bot [master|✚ 1…8⚑ 12]
16:47 $
import sys
import trace
import unittest
from app import check_perm
tracer = trace.Trace(trace=1, ignoredirs=(sys.prefix, sys.exec_prefix))
class Test(unittest.TestCase):
def test_one(self):
tracer.runctx('self.assertFalse(check_perm("dummy", 3))', globals(), locals())
if __name__ == '__main__':
unittest.main()
def sub_check1(some_object):
if some_object * 10 == 20:
return True
def sub_check2(some_object):
if some_object * 10 == 30:
return True
def check_perm(request, some_object):
if some_object == 1:
return True
if some_object == 2:
return sub_check1(some_object)
if some_object == 3:
return sub_check2(some_object)
$ python test_has_perm_in_foobar.py
--- modulename: test_has_perm_in_foobar, funcname: <module>
<string>(1): --- modulename: app, funcname: check_perm
app.py(10): if some_object == 1:
app.py(12): if some_object == 2:
app.py(14): if some_object == 3:
app.py(15): return sub_check2(some_object)
--- modulename: app, funcname: sub_check2
app.py(6): if some_object * 10 == 30:
app.py(7): return True
F
======================================================================
FAIL: test_one (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_has_perm_in_foobar.py", line 23, in test_one
tracer.runctx('self.assertFalse(check_perm("dummy", 3))', globals(), locals())
File "/usr/lib/python2.7/trace.py", line 513, in runctx
exec cmd in globals, locals
File "<string>", line 1, in <module>
AssertionError: True is not false
----------------------------------------------------------------------
Ran 1 test in 0.006s
FAILED (failures=1)
import trace
import unittest
from app import check_perm
tracer = trace.Trace(trace=1)
class Test(unittest.TestCase):
def test_one(self):
self.assertFalse(tracer.runfunc(check_perm, 'dummy', 3))
if __name__ == '__main__':
unittest.main()
$ python test_has_perm_in_foobar.py
--- modulename: app, funcname: check_perm
app.py(10): if some_object == 1:
app.py(12): if some_object == 2:
app.py(14): if some_object == 3:
app.py(15): return sub_check2(some_object)
--- modulename: app, funcname: sub_check2
app.py(6): if some_object * 10 == 30:
app.py(7): return True
F
======================================================================
FAIL: test_one (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_has_perm_in_foobar.py", line 19, in test_one
self.assertFalse(tracer.runfunc(check_perm, 'dummy', 3))
AssertionError: True is not false
----------------------------------------------------------------------
Ran 1 test in 0.005s
FAILED (failures=1)
import pytest
@pytest.mark.A
def test_add():
a = 1
b = 2
add(a,b)
def add(a, b):
assert a>b
return a+b
def main():
add(1,2)
add(2,1)
if __name__ == "__main__":
# execute only if run as a script
main()
art@macky ~/src/python/so-answer-stacktrace: py.test -v --tb=short -m A code.py
============================= test session starts ==============================
platform darwin -- Python 2.7.5 -- pytest-2.5.0 -- /Users/art/.pyenv/versions/2.7.5/bin/python
collected 1 items
code.py:3: test_add FAILED
=================================== FAILURES ===================================
___________________________________ test_add ___________________________________
code.py:9: in test_add
> add(a,b)
code.py:12: in add
> assert a>b
E assert 1 > 2
=========================== 1 failed in 0.01 seconds ===========================
def add(a, b):
from pdb import set_trace;set_trace()
assert a>b
return a+b
art@macky ~/src/python/so-answer-stacktrace: py.test -v --tb=short -m A code.py
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 2.7.5 -- pytest-2.5.0 -- /Users/art/.pyenv/versions/2.7.5/bin/python
collected 1 items
code.py:3: test_add
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /Users/art/src/python/so-answer-stacktrace/code.py(13)add()
-> assert a>b
(Pdb)
(Pdb) w
/Users/art/.pyenv/versions/2.7.5/bin/py.test(9)<module>()
-> load_entry_point('pytest==2.5.0', 'console_scripts', 'py.test')()
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/config.py(19)main()
-> return config.hook.pytest_cmdline_main(config=config)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(376)__call__()
-> return self._docall(methods, kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(387)_docall()
-> res = mc.execute()
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(288)execute()
-> res = method(**kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/main.py(111)pytest_cmdline_main()
-> return wrap_session(config, _main)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/main.py(81)wrap_session()
-> doit(config, session)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/main.py(117)_main()
-> config.hook.pytest_runtestloop(session=session)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(376)__call__()
-> return self._docall(methods, kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(387)_docall()
-> res = mc.execute()
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(288)execute()
-> res = method(**kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/main.py(137)pytest_runtestloop()
-> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(376)__call__()
-> return self._docall(methods, kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(387)_docall()
-> res = mc.execute()
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(288)execute()
-> res = method(**kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/runner.py(62)pytest_runtest_protocol()
-> runtestprotocol(item, nextitem=nextitem)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/runner.py(72)runtestprotocol()
-> reports.append(call_and_report(item, "call", log))
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/runner.py(106)call_and_report()
-> call = call_runtest_hook(item, when, **kwds)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/runner.py(124)call_runtest_hook()
-> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/runner.py(137)__init__()
-> self.result = func()
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/runner.py(124)<lambda>()
-> return CallInfo(lambda: ihook(item=item, **kwds), when=when)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/main.py(161)call_matching_hooks()
-> return hookmethod.pcall(plugins, **kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(380)pcall()
-> return self._docall(methods, kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(387)_docall()
-> res = mc.execute()
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(288)execute()
-> res = method(**kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/runner.py(86)pytest_runtest_call()
-> item.runtest()
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/python.py(1076)runtest()
-> self.ihook.pytest_pyfunc_call(pyfuncitem=self)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/main.py(161)call_matching_hooks()
-> return hookmethod.pcall(plugins, **kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(380)pcall()
-> return self._docall(methods, kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(387)_docall()
-> res = mc.execute()
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/core.py(288)execute()
-> res = method(**kwargs)
/Users/art/.pyenv/versions/2.7.5/lib/python2.7/site-packages/pytest-2.5.0-py2.7.egg/_pytest/python.py(188)pytest_pyfunc_call()
-> testfunction(**testargs)
/Users/art/src/python/so-answer-stacktrace/code.py(9)test_add()
-> add(a,b)
> /Users/art/src/python/so-answer-stacktrace/code.py(13)add()
-> assert a>b
(Pdb)