Skip to content

Commit 90330f2

Browse files
authored
Merge pull request #87 from python-cmd2/transcript_testing
Transcript testing now calls preloop() before and postloop() after
2 parents e8865d3 + 3f92b77 commit 90330f2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,10 @@ def setUp(self):
20302030
self.cmdapp = self.CmdApp()
20312031
self.fetchTranscripts()
20322032

2033+
# Make sure any required initialization gets done and flush the output buffer
2034+
self.cmdapp.preloop()
2035+
self.outputTrap.read()
2036+
20332037
def runTest(self): # was testall
20342038
if self.CmdApp:
20352039
its = sorted(self.transcripts.items())
@@ -2095,6 +2099,9 @@ def _test_transcript(self, fname, transcript):
20952099

20962100
def tearDown(self):
20972101
if self.CmdApp:
2102+
# Make sure any required cleanup gets done
2103+
self.cmdapp.postloop()
2104+
20982105
self.outputTrap.tear_down()
20992106

21002107

0 commit comments

Comments
 (0)