From 04cdcb0feb369ac4c60e10ccdc139c57e8b52e62 Mon Sep 17 00:00:00 2001 From: Zearin Date: Fri, 7 Oct 2011 10:34:23 -0400 Subject: Removed leftovers from installing with pip. Oops! I noticed there was a bunch of extra crap left over from when I installed this module onto my own system. I thought it wouldn't have modified itself at the time (just the Python module library on my system), but I was wrong. Begone, useless cruft! --- doxygen/html/classcmd2_1_1Cmd2TestCase.html | 506 ---------------------------- 1 file changed, 506 deletions(-) delete mode 100644 doxygen/html/classcmd2_1_1Cmd2TestCase.html (limited to 'doxygen/html/classcmd2_1_1Cmd2TestCase.html') diff --git a/doxygen/html/classcmd2_1_1Cmd2TestCase.html b/doxygen/html/classcmd2_1_1Cmd2TestCase.html deleted file mode 100644 index ee68f56..0000000 --- a/doxygen/html/classcmd2_1_1Cmd2TestCase.html +++ /dev/null @@ -1,506 +0,0 @@ - - - - -Cmd2: cmd2::Cmd2TestCase Class Reference - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - -
-
Cmd2 - -
- -
-
- - - - - -
-
- -
-
-
- -
- -
- -

List of all members.

- - - - - - - - - - - - - - - - - - -

-Public Member Functions

def fetchTranscripts
def runTest
def setUp
def tearDown

-Public Attributes

 cmdapp
 outputTrap
 transcripts

-Static Public Attributes

tuple anyWhitespace = re.compile(r'\s', re.DOTALL | re.MULTILINE)
 CmdApp = None
 expectationParser = regexPattern|notRegexPattern
tuple notRegexPattern = pyparsing.Word(pyparsing.printables)
tuple regexPattern = pyparsing.QuotedString(quoteChar=r'/', escChar='\\', multiline=True, unquoteResults=True)

-Private Member Functions

def _test_transcript
-

Detailed Description

-
Subclass this, setting CmdApp, to make a unittest.TestCase class
-   that will execute the commands in a transcript file and expect the results shown.
-   See example.py
-

Definition at line 1476 of file cmd2.py.

-

Member Function Documentation

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
def cmd2::Cmd2TestCase::_test_transcript ( self,
 fname,
 transcript 
) [private]
-
-
- -

Definition at line 1506 of file cmd2.py.

- -

References cmdapp.

- -

Referenced by runTest().

-
01506 
-01507     def _test_transcript(self, fname, transcript):
-01508         lineNum = 0
-01509         finished = False
-01510         line = transcript.next()
-01511         lineNum += 1
-01512         tests_run = 0
-01513         while not finished:
-01514             # Scroll forward to where actual commands begin
-01515             while not line.startswith(self.cmdapp.prompt):
-01516                 try:
-01517                     line = transcript.next()
-01518                 except StopIteration:
-01519                     finished = True
-01520                     break
-01521                 lineNum += 1
-01522             command = [line[len(self.cmdapp.prompt):]]
-01523             line = transcript.next()
-01524             # Read the entirety of a multi-line command
-01525             while line.startswith(self.cmdapp.continuation_prompt):
-01526                 command.append(line[len(self.cmdapp.continuation_prompt):])
-01527                 try:
-01528                     line = transcript.next()
-01529                 except StopIteration:
-01530                     raise (StopIteration, 
-01531                            'Transcript broke off while reading command beginning at line %d with\n%s' 
-01532                            % (command[0]))
-01533                 lineNum += 1
-01534             command = ''.join(command)               
-01535             # Send the command into the application and capture the resulting output
-01536             stop = self.cmdapp.onecmd_plus_hooks(command)
-01537             #TODO: should act on ``stop``
-01538             result = self.outputTrap.read()
-01539             # Read the expected result from transcript
-01540             if line.startswith(self.cmdapp.prompt):
-01541                 message = '\nFile %s, line %d\nCommand was:\n%s\nExpected: (nothing)\nGot:\n%s\n'%\
-01542                     (fname, lineNum, command, result)     
-01543                 self.assert_(not(result.strip()), message)
-01544                 continue
-01545             expected = []
-01546             while not line.startswith(self.cmdapp.prompt):
-01547                 expected.append(line)
-01548                 try:
-01549                     line = transcript.next()
-01550                 except StopIteration:
-01551                     finished = True                       
-01552                     break
-01553                 lineNum += 1
-01554             expected = ''.join(expected)
-01555             # Compare actual result to expected
-01556             message = '\nFile %s, line %d\nCommand was:\n%s\nExpected:\n%s\nGot:\n%s\n'%\
-01557                 (fname, lineNum, command, expected, result)      
-01558             expected = self.expectationParser.transformString(expected)
-01559             # checking whitespace is a pain - let's skip it
-01560             expected = self.anyWhitespace.sub('', expected)
-01561             result = self.anyWhitespace.sub('', result)
-01562             self.assert_(re.match(expected, result, re.MULTILINE | re.DOTALL), message)
-
-
-
-
- -
-
- - - - - - - - -
def cmd2::Cmd2TestCase::fetchTranscripts ( self)
-
-
- -

Definition at line 1481 of file cmd2.py.

- -

Referenced by setUp().

-
01481 
-01482     def fetchTranscripts(self):
-01483         self.transcripts = {}
-01484         for fileset in self.CmdApp.testfiles:
-01485             for fname in glob.glob(fileset):
-01486                 tfile = open(fname)
-01487                 self.transcripts[fname] = iter(tfile.readlines())
-01488                 tfile.close()
-01489         if not len(self.transcripts):
-            raise (StandardError,), "No test files found - nothing to test."
-
-
-
- -
-
- - - - - - - - -
def cmd2::Cmd2TestCase::runTest ( self)
-
-
- -

Definition at line 1495 of file cmd2.py.

- -

References _test_transcript(), and CmdApp.

-
01495 
-01496     def runTest(self): # was testall
-01497         if self.CmdApp:
-01498             its = sorted(self.transcripts.items())
-01499             for (fname, transcript) in its:
-                self._test_transcript(fname, transcript)
-
-
-
- -
-
- - - - - - - - -
def cmd2::Cmd2TestCase::setUp ( self)
-
-
- -

Definition at line 1490 of file cmd2.py.

- -

References CmdApp, cmdapp, fetchTranscripts(), and outputTrap.

-
01490 
-01491     def setUp(self):
-01492         if self.CmdApp:
-01493             self.outputTrap = OutputTrap()
-01494             self.cmdapp = self.CmdApp()
-            self.fetchTranscripts()
-
-
-
- -
-
- - - - - - - - -
def cmd2::Cmd2TestCase::tearDown ( self)
-
-
- -

Definition at line 1563 of file cmd2.py.

- -

References CmdApp.

-
01563 
-01564     def tearDown(self):
-01565         if self.CmdApp:
-01566             self.outputTrap.tearDown()
-
-
-
-
-

Member Data Documentation

- -
-
- - - - -
tuple cmd2::Cmd2TestCase::anyWhitespace = re.compile(r'\s', re.DOTALL | re.MULTILINE) [static]
-
-
- -

Definition at line 1505 of file cmd2.py.

- -
-
- -
-
- - - - -
cmd2::Cmd2TestCase::CmdApp = None [static]
-
-
- -

Definition at line 1480 of file cmd2.py.

- -

Referenced by runTest(), setUp(), and tearDown().

- -
-
- -
- -
- -

Definition at line 1490 of file cmd2.py.

- -

Referenced by _test_transcript(), and setUp().

- -
-
- -
- -
- -

Definition at line 1504 of file cmd2.py.

- -
-
- -
-
- - - - -
tuple cmd2::Cmd2TestCase::notRegexPattern = pyparsing.Word(pyparsing.printables) [static]
-
-
- -

Definition at line 1502 of file cmd2.py.

- -
-
- -
- -
- -

Definition at line 1490 of file cmd2.py.

- -

Referenced by setUp().

- -
-
- -
-
- - - - -
tuple cmd2::Cmd2TestCase::regexPattern = pyparsing.QuotedString(quoteChar=r'/', escChar='\\', multiline=True, unquoteResults=True) [static]
-
-
- -

Definition at line 1500 of file cmd2.py.

- -
-
- -
- -
- -

Definition at line 1481 of file cmd2.py.

- -
-
-
The documentation for this class was generated from the following file:
    -
  • /Users/amrogers/Developer/Projects/cmd2/cmd2.py
  • -
-
-
- - - - - -- cgit v1.2.1