Show
Ignore:
Timestamp:
07/21/06 10:04:44 (7 years ago)
Author:
mk
Message:

Added missing unit tests for command_successful, run_cmd and Index.repr.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mk/cheesecake/util.py

    r78 r98  
    1212def run_cmd(cmd, env=None): 
    1313    """Run command and return its return code and its output. 
     14 
     15    >>> run_cmd('/bin/true') 
     16    (0, '') 
    1417    """ 
    1518    arglist = cmd.split() 
     
    2326def command_successful(cmd): 
    2427    """Returns True if command exited normally, False otherwise. 
     28 
     29    >>> command_successful('/bin/true') 
     30    True 
     31    >>> command_successful('this-command-doesnt-exist') 
     32    False 
    2533    """ 
    2634    rc, output = run_cmd(cmd) 
     
    3038 
    3139class StdoutRedirector(object): 
     40    """Redirect stdout to a temporary file. 
    3241    """ 
    33     Redirect stdout to a temp file 
    34     """ 
    35  
    3642    def __init__(self, filename=None): 
    3743        if filename: 
     
    4753 
    4854    def read_buffer(self): 
    49         """ 
    50         Return contents of the temp file 
     55        """Return contents of the temporary file. 
    5156        """ 
    5257        self.fh.seek(0) 
     
    5459 
    5560def pad_with_dots(msg, length=PAD_TEXT): 
    56     """ 
    57     Pad text with dots up to given length 
     61    """Pad text with dots up to given length. 
    5862    """ 
    5963    length = len(msg)