Spaces Data
Minimal test - lines (203, 207)
path: .spaces[6].spaces[7].spaces[1].metrics.loc.cloc
old: 1.0
new: 2.0
path: .spaces[6].spaces[7].spaces[1].metrics.loc.sloc
old: 4.0
new: 5.0
path: .spaces[6].spaces[7].spaces[1].metrics.mi.mi_sei
old: 152.77484308930326
new: 154.10739759318386
path: .spaces[6].spaces[7].spaces[1].metrics.mi.mi_visual_studio
old: 78.39554672677042
new: 76.28155518800422
path: .spaces[6].spaces[7].spaces[1].metrics.mi.mi_original
old: 134.0563849027774
new: 130.4414593714872
Code
def g():
#
__tracebackhide__ = tracebackhide
f()
#
Minimal test - lines (101, 105)
path: .spaces[4].metrics.loc.sloc
old: 4.0
new: 5.0
path: .spaces[4].metrics.loc.cloc
old: 1.0
new: 2.0
path: .spaces[4].metrics.mi.mi_visual_studio
old: 78.39554672677042
new: 76.28155518800422
path: .spaces[4].metrics.mi.mi_original
old: 134.0563849027774
new: 130.4414593714872
path: .spaces[4].metrics.mi.mi_sei
old: 152.77484308930326
new: 154.10739759318386
Code
def g():
#
__tracebackhide__ = True
f()
#
Minimal test - lines (209, 212)
path: .spaces[6].spaces[7].spaces[2].metrics.mi.mi_visual_studio
old: 84.71624627594792
new: 81.99083716851001
path: .spaces[6].spaces[7].spaces[2].metrics.mi.mi_original
old: 144.86478113187096
new: 140.20433155815212
path: .spaces[6].spaces[7].spaces[2].metrics.mi.mi_sei
old: 172.3892017250539
new: 171.12966392385397
path: .spaces[6].spaces[7].spaces[2].metrics.loc.sloc
old: 3.0
new: 4.0
path: .spaces[6].spaces[7].spaces[2].metrics.loc.cloc
old: 1.0
new: 2.0
Code
def h():
#
g()
#
Minimal test - lines (67, 89)
path: .spaces[2].metrics.loc.sloc
old: 20.0
new: 23.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[2].metrics.mi.mi_original
old: 89.93352152346385
new: 87.66937805698629
path: .spaces[2].metrics.mi.mi_sei
old: 54.65671267599616
new: 77.92849157665631
path: .spaces[2].metrics.mi.mi_visual_studio
old: 52.592702645300506
new: 51.26864213858848
Code
def test_excinfo_getstatement():
def g():
raise ValueError
def f():
g()
try:
f()
except ValueError:
excinfo = _pytest._code.ExceptionInfo()
linenumbers = [
_pytest._code.getrawcode(f).co_firstlineno - 1 + 4,
_pytest._code.getrawcode(f).co_firstlineno - 1 + 1,
_pytest._code.getrawcode(g).co_firstlineno - 1 + 1,
]
values = list(excinfo.traceback)
foundlinenumbers = [x.lineno for x in values]
assert foundlinenumbers == linenumbers
# for x in info:
# print "%s:%d %s" %(x.path.relto(root), x.lineno, x.statement)
# xxx
Minimal test - lines (108, 111)
path: .spaces[5].metrics.loc.sloc
old: 3.0
new: 4.0
path: .spaces[5].metrics.loc.cloc
old: 1.0
new: 2.0
path: .spaces[5].metrics.mi.mi_original
old: 144.86478113187096
new: 140.20433155815212
path: .spaces[5].metrics.mi.mi_sei
old: 172.3892017250539
new: 171.12966392385397
path: .spaces[5].metrics.mi.mi_visual_studio
old: 84.71624627594792
new: 81.99083716851001
Code
def h():
#
g()
#
Minimal test - lines (95, 98)
path: .spaces[3].metrics.mi.mi_original
old: 142.15938490684147
new: 137.49893533312263
path: .spaces[3].metrics.mi.mi_sei
old: 168.48614000756413
new: 167.22660220636422
path: .spaces[3].metrics.mi.mi_visual_studio
old: 83.13414322037512
new: 80.40873411293721
path: .spaces[3].metrics.loc.cloc
old: 1.0
new: 2.0
path: .spaces[3].metrics.loc.sloc
old: 3.0
new: 4.0
Code
def f():
#
raise ValueError
#
Minimal test - lines (198, 201)
path: .spaces[6].spaces[7].spaces[0].metrics.mi.mi_original
old: 142.15938490684147
new: 137.49893533312263
path: .spaces[6].spaces[7].spaces[0].metrics.mi.mi_sei
old: 168.48614000756413
new: 167.22660220636422
path: .spaces[6].spaces[7].spaces[0].metrics.mi.mi_visual_studio
old: 83.13414322037512
new: 80.40873411293721
path: .spaces[6].spaces[7].spaces[0].metrics.loc.sloc
old: 3.0
new: 4.0
path: .spaces[6].spaces[7].spaces[0].metrics.loc.cloc
old: 1.0
new: 2.0
Code
def f():
#
raise ValueError
#
Minimal test - lines (594, 625)
path: .spaces[17].spaces[8].metrics.loc.cloc
old: 2.0
new: 3.0
path: .spaces[17].spaces[8].metrics.loc.sloc
old: 31.0
new: 32.0
path: .spaces[17].spaces[8].metrics.mi.mi_visual_studio
old: 46.14107970922934
new: 45.84030256730174
path: .spaces[17].spaces[8].metrics.mi.mi_original
old: 78.90124630278217
new: 78.38691739008597
path: .spaces[17].spaces[8].metrics.mi.mi_sei
old: 58.31873870544183
new: 61.2434076602793
Code
def test_repr_tracebackentry_lines(self, importasmod):
mod = importasmod(
"""
def func1():
raise ValueError("hello\\nworld")
"""
)
excinfo = pytest.raises(ValueError, mod.func1)
excinfo.traceback = excinfo.traceback.filter()
p = FormattedExcinfo()
reprtb = p.repr_traceback_entry(excinfo.traceback[-1])
# test as intermittent entry
lines = reprtb.lines
assert lines[0] == " def func1():"
assert lines[1] == '> raise ValueError("hello\\nworld")'
# test as last entry
p = FormattedExcinfo(showlocals=True)
repr_entry = p.repr_traceback_entry(excinfo.traceback[-1], excinfo)
lines = repr_entry.lines
assert lines[0] == " def func1():"
assert lines[1] == '> raise ValueError("hello\\nworld")'
assert lines[2] == "E ValueError: hello"
assert lines[3] == "E world"
assert not lines[4:]
loc = repr_entry.reprlocals is not None
loc = repr_entry.reprfileloc
assert loc.path == mod.__file__
assert loc.lineno == 3
# assert loc.message == "ValueError: hello"