Spaces Data
Minimal test - lines (10, 40)
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 27.0
new: 31.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 47.37606207634734
new: 70.55757153686517
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 84.74580679073276
new: 82.50777130734352
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 49.5589513396098
new: 48.25015865926522
Code
def test_basic_testitem_events(self, testdir):
tfile = testdir.makepyfile(
"""
def test_one():
pass
def test_one_one():
assert 0
def test_other():
raise ValueError(23)
class TestClass(object):
def test_two(self, someargs):
pass
"""
)
reprec = testdir.inline_run(tfile)
passed, skipped, failed = reprec.listoutcomes()
assert len(skipped) == 0
assert len(passed) == 1
assert len(failed) == 3
def end(x):
return x.nodeid.split("::")[-1]
assert end(failed[0]) == "test_one_one"
assert end(failed[1]) == "test_other"
itemstarted = reprec.getcalls("pytest_itemcollected")
assert len(itemstarted) == 4
# XXX check for failing funcarg setup
# colreports = reprec.getcalls("pytest_collectreport")
# assert len(colreports) == 4
# assert colreports[1].report.failed
Minimal test - lines (244, 253)
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[2].metrics.loc.sloc
old: 7.0
new: 10.0
path: .spaces[2].metrics.mi.mi_original
old: 121.27353187219173
new: 115.49539778038424
path: .spaces[2].metrics.mi.mi_sei
old: 99.3616908904923
new: 128.54101485158282
path: .spaces[2].metrics.mi.mi_visual_studio
old: 70.9201940773051
new: 67.54116829262237
Code
def test_plugin_specify(testdir):
pytest.raises(
ImportError,
"""
testdir.parseconfig("-p", "nqweotexistent")
""",
)
# pytest.raises(ImportError,
# "config.do_configure(config)"
# )
Minimal test - lines (172, 197)
path: .spaces[1].spaces[0].metrics.loc.sloc
old: 25.0
new: 26.0
path: .spaces[1].spaces[0].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[1].spaces[0].metrics.mi.mi_visual_studio
old: 54.41690958508688
new: 54.04534493416106
path: .spaces[1].spaces[0].metrics.mi.mi_original
old: 93.05291539049855
new: 92.4175398374154
path: .spaces[1].spaces[0].metrics.mi.mi_sei
old: 58.85158716033324
new: 72.89339171201689
Code
def test_order_of_execution(self, testdir):
reprec = testdir.inline_runsource(
"""
values = []
def test_1():
values.append(1)
def test_2():
values.append(2)
def test_3():
assert values == [1,2]
class Testmygroup(object):
reslist = values
def test_1(self):
self.reslist.append(1)
def test_2(self):
self.reslist.append(2)
def test_3(self):
self.reslist.append(3)
def test_4(self):
assert self.reslist == [1,2,1,2,3]
"""
)
passed, skipped, failed = reprec.countoutcomes()
assert failed == skipped == 0
assert passed == 7
# also test listnames() here ...