Ignore:
Timestamp:
12/28/08 15:16:50 (5 years ago)
Author:
xi
Message:

Refactored the test suite; updated include and library paths in setup.cfg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/tests/test_recursive.py

    r222 r322  
    11 
    2 import test_appliance 
    3  
    4 from yaml import * 
     2import yaml 
    53 
    64class AnInstance: 
     
    2523        self.foo, self.bar = state['attributes'] 
    2624 
    27 class TestRecursive(test_appliance.TestAppliance): 
    28  
    29     def _testRecursive(self, test_name, recursive_filename): 
    30         exec file(recursive_filename, 'r').read() 
    31         value1 = value 
    32         output1 = None 
    33         value2 = None 
    34         output2 = None 
    35         try: 
    36             output1 = dump(value1) 
    37             #print "OUTPUT %s:" % test_name 
    38             #print output1 
    39             value2 = load(output1) 
    40             output2 = dump(value2) 
    41             self.failUnlessEqual(output1, output2) 
    42         except: 
     25def test_recursive(recursive_filename, verbose=False): 
     26    exec open(recursive_filename, 'rb').read() 
     27    value1 = value 
     28    output1 = None 
     29    value2 = None 
     30    output2 = None 
     31    try: 
     32        output1 = yaml.dump(value1) 
     33        value2 = yaml.load(output1) 
     34        output2 = yaml.dump(value2) 
     35        assert output1 == output2, (output1, output2) 
     36    finally: 
     37        if verbose: 
    4338            print "VALUE1:", value1 
    4439            print "VALUE2:", value2 
     
    4742            print "OUTPUT2:" 
    4843            print output2 
    49             raise 
    5044 
    51 TestRecursive.add_tests('testRecursive', '.recursive') 
     45test_recursive.unittest = ['.recursive'] 
    5246 
     47if __name__ == '__main__': 
     48    import test_appliance 
     49    test_appliance.run(globals()) 
     50 
Note: See TracChangeset for help on using the changeset viewer.