summaryrefslogtreecommitdiff
path: root/cmd2/transcript.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-24 10:22:18 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-24 10:22:18 -0400
commit806fe461acee59bcda791a9cb9ebf396af80126e (patch)
tree9c7763ad6fca4057c06dc8b67c56537b6d960c59 /cmd2/transcript.py
parentb82015248f4a1c941864c6608ab4457da752df95 (diff)
parente5e8a7954b9ace78cd49ef43c5f8d6203c227f0f (diff)
downloadcmd2-git-806fe461acee59bcda791a9cb9ebf396af80126e.tar.gz
Merged master in to colorize and resolved conflicts
Diffstat (limited to 'cmd2/transcript.py')
-rw-r--r--cmd2/transcript.py26
1 files changed, 1 insertions, 25 deletions
diff --git a/cmd2/transcript.py b/cmd2/transcript.py
index 3ac304ca..2d94f4e4 100644
--- a/cmd2/transcript.py
+++ b/cmd2/transcript.py
@@ -44,7 +44,7 @@ class Cmd2TestCase(unittest.TestCase):
# Trap stdout
self._orig_stdout = self.cmdapp.stdout
- self.cmdapp.stdout = OutputTrap()
+ self.cmdapp.stdout = utils.StdSim(self.cmdapp.stdout)
def runTest(self): # was testall
if self.cmdapp:
@@ -203,27 +203,3 @@ class Cmd2TestCase(unittest.TestCase):
if self.cmdapp:
# Restore stdout
self.cmdapp.stdout = self._orig_stdout
-
-class OutputTrap(object):
- """Instantiate an OutputTrap to divert/capture ALL stdout output.
- For use in transcript testing.
- """
-
- def __init__(self):
- self.contents = ''
-
- def write(self, txt: str):
- """Add text to the internal contents."""
- self.contents += txt
-
- def read(self) -> str:
- """Read from the internal contents and then clear them out.
-
- :return: str - text from the internal contents
- """
- result = self.contents
- self.contents = ''
- return result
-
- def isatty(self) -> bool:
- return True