Skip to content

Commit 55f8af7

Browse files
committed
✔️ refactor tests to use pytest
1 parent 7580f2c commit 55f8af7

File tree

9 files changed

+302
-341
lines changed

9 files changed

+302
-341
lines changed

src/test_bpmn.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/test_promo.py

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from processpiper import ProcessMap, EventType, ActivityType, GatewayType
2+
from util_test import get_test_file_path
23

34

45
def test_case01():
@@ -16,11 +17,8 @@ def test_case01():
1617
process_map.set_footer("My footer", font_size=20)
1718

1819
process_map.draw()
19-
output_file = "images/test/test_appearance01.png"
20+
21+
output_file = get_test_file_path("test_appearance_01.png")
2022
process_map.save(output_file)
2123
output_file = output_file.replace(".png", ".bpmn")
2224
process_map.export_to_bpmn(output_file)
23-
24-
25-
if __name__ == "__main__":
26-
test_case01()
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from processpiper import ProcessMap, EventType, ActivityType, GatewayType
2+
from util_test import get_test_file_path
23

34

45
def test_case01():
56
with ProcessMap(
6-
"Pizza Order Process", colour_theme="BLUEMOUNTAIN"
7+
"Pizza Order Process", colour_theme="BLUEMOUNTAIN"
78
) as my_process_map:
89
with my_process_map.add_lane("Customer") as lane1:
910
start = lane1.add_element("start", EventType.START)
@@ -35,13 +36,16 @@ def test_case01():
3536
receive_pizza.connect(end)
3637
my_process_map.set_footer(" Generated by Process Piper")
3738
my_process_map.draw()
38-
my_process_map.save("images/test/pizza-order-process.png")
39-
my_process_map.export_to_bpmn("images/test/pizza-order-process.bpmn")
39+
40+
output_png = get_test_file_path("test_case_01.png")
41+
output_bpmn = get_test_file_path("test_case_01.bpmn")
42+
my_process_map.save(output_png)
43+
my_process_map.export_to_bpmn(output_bpmn)
4044

4145

4246
def test_case02():
4347
with ProcessMap(
44-
"Sample Test Process", colour_theme="BLUEMOUNTAIN"
48+
"Sample Test Process", colour_theme="BLUEMOUNTAIN"
4549
) as my_process_map:
4650
with my_process_map.add_lane("End User") as lane1:
4751
start = lane1.add_element("Start", EventType.START)
@@ -68,10 +72,8 @@ def test_case02():
6872

6973
my_process_map.set_footer("Generated by ProcessPiper")
7074
my_process_map.draw()
71-
my_process_map.save("images/test/my_process_map.png")
72-
my_process_map.export_to_bpmn("images/test/my_process_map.bpmn")
73-
7475

75-
if __name__ == "__main__":
76-
test_case01()
77-
test_case02()
76+
output_png = get_test_file_path("test_case_02.png")
77+
output_bpmn = get_test_file_path("test_case_02.bpmn")
78+
my_process_map.save(output_png)
79+
my_process_map.export_to_bpmn(output_bpmn)

0 commit comments

Comments
 (0)