Skip to content

Commit c507cbd

Browse files
committed
rework test assertions, add test for force_finalize
1 parent 421a1be commit c507cbd

4 files changed

Lines changed: 229 additions & 160 deletions

File tree

test/cases/force_finalize.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import scorep.user
2+
3+
4+
def foo():
5+
print("foo")
6+
7+
8+
def bar():
9+
print("bar")
10+
11+
12+
foo()
13+
scorep.user.force_finalize()
14+
bar()

test/conftest.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import utils
2+
3+
4+
def pytest_assertrepr_compare(op, left, right):
5+
if isinstance(left, utils.OTF2_Region) and isinstance(right, utils.OTF2_Trace):
6+
if op == "in":
7+
output = ["Region \"{}\" ENTER or LEAVE not found in trace:".format(left)]
8+
for line in str(right).split("\n"):
9+
output.append("\t" + line)
10+
return output
11+
elif op == "not in":
12+
output = ["Unexpected region \"{}\" ENTER or LEAVE found in trace:".format(left)]
13+
for line in str(right).split("\n"):
14+
output.append("\t" + line)
15+
return output
16+
elif isinstance(left, utils.OTF2_Parameter) and isinstance(right, utils.OTF2_Trace) and op == "in":
17+
output = ["Parameter \"{parameter}\" with Value \"{value}\" not found in trace:".format(
18+
parameter=left.parameter,
19+
value=left.value)]
20+
for line in str(right).split("\n"):
21+
output.append("\t" + line)
22+
return output

0 commit comments

Comments
 (0)