Skip to content

Commit 85004d9

Browse files
committed
Speed up the mediator example and run it thrice
1 parent cc783a0 commit 85004d9

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

mediator.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ def __init__(self):
1414

1515
def setup(self):
1616
print("Setting up the Test")
17-
time.sleep(1)
17+
time.sleep(0.1)
1818
self._tm.prepareReporting()
1919

2020
def execute(self):
2121
if not self._bProblem:
2222
print("Executing the test")
23-
time.sleep(1)
23+
time.sleep(0.1)
2424
else:
2525
print("Problem in setup. Test not executed.")
2626

2727
def tearDown(self):
2828
if not self._bProblem:
2929
print("Tearing down")
30-
time.sleep(1)
30+
time.sleep(0.1)
3131
self._tm.publishReport()
3232
else:
3333
print("Test not executed. No tear down required.")
@@ -45,11 +45,11 @@ def __init__(self):
4545

4646
def prepare(self):
4747
print("Reporter Class is preparing to report the results")
48-
time.sleep(1)
48+
time.sleep(0.1)
4949

5050
def report(self):
5151
print("Reporting the results of Test")
52-
time.sleep(1)
52+
time.sleep(0.1)
5353

5454
def setTM(self, tm):
5555
self._tm = tm
@@ -61,15 +61,14 @@ def __init__(self):
6161

6262
def insert(self):
6363
print("Inserting the execution begin status in the Database")
64-
time.sleep(1)
64+
time.sleep(0.1)
6565
#Following code is to simulate a communication from DB to TC
66-
import random
6766
if random.randrange(1, 4) == 3:
6867
return -1
6968

7069
def update(self):
7170
print("Updating the test results in Database")
72-
time.sleep(1)
71+
time.sleep(0.1)
7372

7473
def setTM(self, tm):
7574
self._tm = tm
@@ -112,7 +111,7 @@ def setTC(self, tc):
112111
# For simplification we are looping on the same test.
113112
# Practically, it could be about various unique test classes and their
114113
# objects
115-
while True:
114+
for i in range(3):
116115
tc = TC()
117116
tc.setTM(tm)
118117
tm.setTC(tc)

0 commit comments

Comments
 (0)