IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 24, 2010, 3:50:36 PM (16 years ago)
Author:
Serge CHASTEL
Message:

Improved unit tests/code coverage. Some refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sc_branches/psps_testing/utilities/test_product.py

    r29227 r29235  
    77    enriched with anything useful for following tests.
    88    """
    9     def __init__(self):
     9    def __init__(self, success = False):
    1010        """
    1111        Creates a test product and set the success status to False.
     
    1313        >>> print TestProduct().success
    1414        False
     15        >>> print TestProduct(True).success
     16        True
    1517        """
    16         self.success = False
     18        self.success = success
    1719
    1820if __name__ == '__main__':
     21    import logging
    1922    import sys
    20     if len(sys.argv) == 2 and sys.argv[1]=='test':
    21         print 'Running TestProduct unit tests'
    22         import doctest
    23         doctest.testmod()
    24         sys.exit(0)
     23    current_argument_position = 1
     24    while current_argument_position < len(sys.argv):
     25        if sys.argv[current_argument_position] == '-debug': # pragma: no cover
     26            PsPsLogger.setLevel(logging.DEBUG)
     27            PsPsLogger.set_stderr()
     28            current_argument_position += 1
     29        elif sys.argv[current_argument_position] == 'test':
     30            print 'Running unittest for TestProduct class'
     31            import doctest
     32            doctest.testmod()
     33            sys.exit(0)
    2534
Note: See TracChangeset for help on using the changeset viewer.