• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python interfaces.Stacktrace类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sentry.interfaces.Stacktrace的典型用法代码示例。如果您正苦于以下问题:Python Stacktrace类的具体用法?Python Stacktrace怎么用?Python Stacktrace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Stacktrace类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_get_hash_ignores_filename_if_https

 def test_get_hash_ignores_filename_if_https(self):
     interface = Stacktrace(frames=[{
         'context_line': 'hello world',
         'filename': 'https://foo.com/foo.py',
     }])
     result = interface.get_hash()
     self.assertEquals(result, ['hello world'])
开发者ID:DouweM,项目名称:sentry,代码行数:7,代码来源:tests.py


示例2: test_serialize_returns_frames

 def test_serialize_returns_frames(self):
     interface = Stacktrace(frames=[{
         'lineno': 1,
         'filename': 'foo.py',
     }])
     result = interface.serialize()
     self.assertTrue('frames' in result)
开发者ID:Crowdbooster,项目名称:sentry,代码行数:7,代码来源:tests.py


示例3: test_get_composite_hash_uses_exception_value_if_no_type_or_stack

 def test_get_composite_hash_uses_exception_value_if_no_type_or_stack(self):
     interface = Stacktrace(frames=[])
     interface_exc = Exception(value='bar')
     result = interface.get_composite_hash({
         'sentry.interfaces.Exception': interface_exc,
     })
     self.assertEquals(result[-1], 'bar')
开发者ID:crockpotveggies,项目名称:BurntVeggies,代码行数:7,代码来源:tests.py


示例4: test_get_hash_with_only_required_vars

 def test_get_hash_with_only_required_vars(self):
     interface = Stacktrace(frames=[{
         'lineno': 1,
         'filename': 'foo.py',
     }])
     result = interface.get_hash()
     self.assertEquals(result, ['foo.py', 1])
开发者ID:Crowdbooster,项目名称:sentry,代码行数:7,代码来源:tests.py


示例5: test_get_composite_hash_uses_exception_if_present

 def test_get_composite_hash_uses_exception_if_present(self):
     interface = Stacktrace(
         frames=[{"context_line": "foo bar", "lineno": 1, "filename": "foo.py", "function": "bar"}]
     )
     interface_exc = Exception(type="exception", value="bar")
     result = interface.get_composite_hash({"sentry.interfaces.Exception": interface_exc})
     self.assertEquals(result[-1], "exception")
开发者ID:CaseCommonsDevOps,项目名称:sentry,代码行数:7,代码来源:tests.py


示例6: test_to_html_response

 def test_to_html_response(self, get_traceback):
     event = mock.Mock(spec=Event())
     event.message = 'foo'
     get_traceback.return_value = 'bar'
     interface = Stacktrace(frames=[{'lineno': 1, 'filename': 'foo.py'}])
     result = interface.to_html(event)
     get_traceback.assert_called_once_with(event, newest_first=False)
     self.assertTrue('<div class="module">' in result)
开发者ID:Supy,项目名称:sentry,代码行数:8,代码来源:tests.py


示例7: test_get_hash_uses_module_over_filename

 def test_get_hash_uses_module_over_filename(self):
     interface = Stacktrace(frames=[{
         'lineno': 1,
         'filename': 'foo.py',
         'module': 'foo'
     }])
     result = interface.get_hash()
     self.assertEquals(result, ['foo', 1])
开发者ID:Crowdbooster,项目名称:sentry,代码行数:8,代码来源:tests.py


示例8: test_get_hash_uses_function_over_lineno

 def test_get_hash_uses_function_over_lineno(self):
     interface = Stacktrace(frames=[{
         'lineno': 1,
         'filename': 'foo.py',
         'function': 'bar'
     }])
     result = interface.get_hash()
     self.assertEquals(result, ['foo.py', 'bar'])
开发者ID:Crowdbooster,项目名称:sentry,代码行数:8,代码来源:tests.py


示例9: test_get_traceback_response

 def test_get_traceback_response(self, get_stacktrace):
     event = mock.Mock(spec=Event())
     event.message = "foo"
     get_stacktrace.return_value = "bar"
     interface = Stacktrace(frames=[{"lineno": 1, "filename": "foo.py"}])
     result = interface.get_traceback(event)
     get_stacktrace.assert_called_once_with(event, newest_first=None)
     self.assertEquals(result, "foo\n\nbar")
开发者ID:CaseCommonsDevOps,项目名称:sentry,代码行数:8,代码来源:tests.py


示例10: test_get_traceback_response

 def test_get_traceback_response(self, get_stacktrace):
     event = mock.Mock(spec=Event)
     event.message = 'foo'
     get_stacktrace.return_value = 'bar'
     interface = Stacktrace(frames=[])
     result = interface.get_traceback(event)
     get_stacktrace.assert_called_once_with(event)
     self.assertEquals(result, 'foo\n\nbar')
开发者ID:Crowdbooster,项目名称:sentry,代码行数:8,代码来源:tests.py


示例11: test_get_hash_sanitizes_block_functions

 def test_get_hash_sanitizes_block_functions(self):
     # This is Ruby specific
     interface = Stacktrace(frames=[{
         'filename': 'foo.py',
         'function': 'block in _conditional_callback_around_233',
     }])
     result = interface.get_hash()
     self.assertEquals(result, ['foo.py', 'block'])
开发者ID:crockpotveggies,项目名称:BurntVeggies,代码行数:8,代码来源:tests.py


示例12: test_to_html_response

 def test_to_html_response(self, get_traceback):
     event = mock.Mock(spec=Event)
     event.message = 'foo'
     get_traceback.return_value = 'bar'
     interface = Stacktrace(frames=[])
     result = interface.to_html(event)
     get_traceback.assert_called_once_with(event)
     self.assertTrue('<div id="traceback" class="module">' in result)
开发者ID:Crowdbooster,项目名称:sentry,代码行数:8,代码来源:tests.py


示例13: test_get_hash_sanitizes_erb_templates

 def test_get_hash_sanitizes_erb_templates(self):
     # This is Ruby specific
     interface = Stacktrace(frames=[{
         'filename': 'foo.html.erb',
         'function': '_foo_html_erb__3327151541118998292_70361296749460',
     }])
     result = interface.get_hash()
     self.assertEquals(result, [
         'foo.html.erb', '_foo_html_erb__<anon>_<anon>',
     ])
开发者ID:crockpotveggies,项目名称:BurntVeggies,代码行数:10,代码来源:tests.py


示例14: test_get_composite_hash_uses_exception_if_present

 def test_get_composite_hash_uses_exception_if_present(self):
     interface = Stacktrace(frames=[{
         'context_line': 'foo bar',
         'lineno': 1,
         'filename': 'foo.py',
         'function': 'bar'
     }])
     interface_exc = Exception(type='exception', value='bar')
     result = interface.get_composite_hash({
         'sentry.interfaces.Exception': interface_exc,
     })
     self.assertEquals(result[-1], 'exception')
开发者ID:Supy,项目名称:sentry,代码行数:12,代码来源:tests.py


示例15: test_to_html_render_call

 def test_to_html_render_call(self, render_to_string, get_traceback):
     event = mock.Mock(spec=Event)
     get_traceback.return_value = 'bar'
     interface = Stacktrace(frames=[])
     result = interface.to_html(event)
     get_traceback.assert_called_once_with(event)
     render_to_string.assert_called_once_with('sentry/partial/interfaces/stacktrace.html', {
         'event': event,
         'frames': [],
         'stacktrace': 'bar',
     })
     self.assertEquals(result, render_to_string.return_value)
开发者ID:Crowdbooster,项目名称:sentry,代码行数:12,代码来源:tests.py


示例16: test_get_stacktrace_with_filename_function_lineno_and_context

 def test_get_stacktrace_with_filename_function_lineno_and_context(self):
     event = mock.Mock(spec=Event())
     interface = Stacktrace(
         frames=[
             {"filename": "foo", "function": "biz", "lineno": 3, "context_line": "  def foo(r):"},
             {"filename": "bar", "function": "baz", "lineno": 5, "context_line": "    return None"},
         ]
     )
     result = interface.get_stacktrace(event)
     self.assertEquals(
         result,
         'Stacktrace (most recent call last):\n\n  File "foo", line 3, in biz\n    def foo(r):\n  File "bar", line 5, in baz\n    return None',
     )
开发者ID:CaseCommonsDevOps,项目名称:sentry,代码行数:13,代码来源:tests.py


示例17: test_to_html_render_call

 def test_to_html_render_call(self, render_to_string, get_traceback):
     event = mock.Mock(spec=Event())
     get_traceback.return_value = 'bar'
     interface = Stacktrace(frames=[{'lineno': 1, 'filename': 'foo.py'}])
     result = interface.to_html(event)
     get_traceback.assert_called_once_with(event, newest_first=False)
     render_to_string.assert_called_once_with('sentry/partial/interfaces/stacktrace.html', {
         'event': event,
         'frames': [{'function': None, 'abs_path': None, 'start_lineno': None, 'lineno': 1, 'context': [], 'vars': [], 'in_app': True, 'filename': 'foo.py'}],
         'stacktrace': 'bar',
         'system_frames': 0,
         'newest_first': False,
     })
     self.assertEquals(result, render_to_string.return_value)
开发者ID:Supy,项目名称:sentry,代码行数:14,代码来源:tests.py


示例18: test_to_html_render_call

 def test_to_html_render_call(self, get_frame_context, render_to_string, get_traceback):
     event = mock.Mock(spec=Event())
     get_traceback.return_value = 'bar'
     interface = Stacktrace(frames=[{'lineno': 1, 'filename': 'foo.py'}])
     result = interface.to_html(event)
     get_traceback.assert_called_once_with(event, newest_first=False)
     get_frame_context.assert_called_once_with(interface.frames[0], event=event, is_public=False)
     render_to_string.assert_called_once_with('sentry/partial/interfaces/stacktrace.html', {
         'event': event,
         'frames': [get_frame_context.return_value],
         'stacktrace': 'bar',
         'system_frames': 0,
         'newest_first': False,
         'is_public': False,
     })
     self.assertEquals(result, render_to_string.return_value)
开发者ID:DouweM,项目名称:sentry,代码行数:16,代码来源:tests.py


示例19: test_get_hash_sanitizes_versioned_filenames

    def test_get_hash_sanitizes_versioned_filenames(self):
        # This is Ruby specific
        interface = Stacktrace(frames=[{
            'filename': '/data/foo/releases/20140114151955/app/views/foo.html.erb',
            'context_line': '<% if @hotels.size > 0 %>',
        }])
        result = interface.get_hash()
        self.assertEquals(result, [
            '/data/foo/releases/<version>/app/views/foo.html.erb',
            '<% if @hotels.size > 0 %>',
        ])

        interface = Stacktrace(frames=[{
            'filename': '20140114151955/app/views/foo.html.erb',
            'context_line': '<% if @hotels.size > 0 %>',
        }])
        result = interface.get_hash()
        self.assertEquals(result, [
            '<version>/app/views/foo.html.erb',
            '<% if @hotels.size > 0 %>',
        ])
开发者ID:crockpotveggies,项目名称:BurntVeggies,代码行数:21,代码来源:tests.py


示例20: test_to_html_render_call

 def test_to_html_render_call(self, get_frame_context, render_to_string, get_traceback):
     event = mock.Mock(spec=Event())
     get_traceback.return_value = "bar"
     interface = Stacktrace(frames=[{"lineno": 1, "filename": "foo.py"}])
     result = interface.to_html(event)
     get_traceback.assert_called_once_with(event, newest_first=False)
     get_frame_context.assert_called_once_with(event=event, is_public=False)
     render_to_string.assert_called_once_with(
         "sentry/partial/interfaces/stacktrace.html",
         {
             "event": event,
             "frames": [get_frame_context.return_value],
             "stacktrace": "bar",
             "stack_id": "stacktrace_1",
             "system_frames": 0,
             "newest_first": False,
             "is_public": False,
             "first_frame_omitted": None,
             "last_frame_omitted": None,
         },
     )
     self.assertEquals(result, render_to_string.return_value)
开发者ID:CaseCommonsDevOps,项目名称:sentry,代码行数:22,代码来源:tests.py



注:本文中的sentry.interfaces.Stacktrace类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.get_interface函数代码示例发布时间:2022-05-27
下一篇:
Python http.safe_urlread函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap