예제 #1
0
 def test_line_nooutput(self):
     sys.stdout = six.StringIO()
     s = debug.Spew(trace_names=['foo'])
     f = sys._getframe()
     s(f, "line", None)
     output = sys.stdout.getvalue()
     assert output == ""
예제 #2
0
 def test_line_nooutput(self):
     sys.stdout = six.StringIO()
     s = debug.Spew(trace_names=['foo'])
     f = sys._getframe()
     s(f, "line", None)
     output = sys.stdout.getvalue()
     self.failUnlessEqual(output, "")
예제 #3
0
 def test_line_nooutput(self):
     sys.stdout = StringIO()
     s = debug.Spew(trace_names=['foo'])
     f = sys._getframe()
     s(f, "line", None)
     lineno = f.f_lineno - 1  # -1 here since we called with frame f in the line above
     output = sys.stdout.getvalue()
     self.failUnlessEqual(output, "")
예제 #4
0
 def test_line_novalue(self):
     sys.stdout = six.StringIO()
     s = debug.Spew(show_values=False)
     f = sys._getframe()
     s(f, "line", None)
     lineno = f.f_lineno - 1  # -1 here since we called with frame f in the line above
     output = sys.stdout.getvalue()
     assert "%s:%i" % (__name__, lineno) in output, "Didn't find line %i in %s" % (lineno, output)
     assert "f=<frame object at" not in output
예제 #5
0
 def test_line(self):
     sys.stdout = six.StringIO()
     s = debug.Spew()
     f = sys._getframe()
     s(f, "line", None)
     lineno = f.f_lineno - 1  # -1 here since we called with frame f in the line above
     output = sys.stdout.getvalue()
     self.failUnless("%s:%i" % (__name__, lineno) in output,
                     "Didn't find line %i in %s" % (lineno, output))
     self.failUnless("f=<frame object at" in output)
예제 #6
0
 def test_line_nofile(self):
     sys.stdout = six.StringIO()
     s = debug.Spew()
     g = globals().copy()
     del g['__file__']
     f = eval("sys._getframe()", g)
     lineno = f.f_lineno
     s(f, "line", None)
     output = sys.stdout.getvalue()
     assert "[unknown]:%i" % lineno in output, "Didn't find [unknown]:%i in %s" % (lineno, output)
     assert "VM instruction #" in output, output
예제 #7
0
 def test_line_global(self):
     global GLOBAL_VAR
     sys.stdout = six.StringIO()
     GLOBAL_VAR = debug.Spew()
     f = sys._getframe()
     GLOBAL_VAR(f, "line", None)
     lineno = f.f_lineno - 1  # -1 here since we called with frame f in the line above
     output = sys.stdout.getvalue()
     assert "%s:%i" % (__name__, lineno) in output, "Didn't find line %i in %s" % (lineno, output)
     assert "f=<frame object at" in output
     assert "GLOBAL_VAR" in f.f_globals
     assert "GLOBAL_VAR=<eventlet.debug.Spew object at" in output
     del GLOBAL_VAR
예제 #8
0
    def test_line(self):
        if sys.version_info >= (3, 7):
            frame_str = "f=<frame at"
        else:
            frame_str = "f=<frame object at"

        sys.stdout = six.StringIO()
        s = debug.Spew()
        f = sys._getframe()
        s(f, "line", None)
        lineno = f.f_lineno - 1  # -1 here since we called with frame f in the line above
        output = sys.stdout.getvalue()
        assert "%s:%i" % (
            __name__, lineno) in output, "Didn't find line %i in %s" % (lineno,
                                                                        output)
        assert frame_str in output