Beispiel #1
0
    def __init__( self, targets, options ):
        super( FamilyConfigMode, self ).__init__( targets, options )

        # Provide subclasses the occasion to process test after loading but
        # before writing back the config file. Intended for more 'general'
        # use than test_hook() which applies to a sole given test.
        self.setup()
        
        for (family, test_list) in Test._families_map.iteritems():
            config_path  = config_file_path( family )
            if os.path.exists( config_path ):
                toolkit.keep_a_timed_version( config_path )

            config_file  = open(config_path, 'w')

            config_text  = ( '"""Pytest config file.\n\n%s\n"""'% toolkit.doc(Test) )

            for test in test_list:
                self.test_hook( test )
                config_text += "\n%s\n" % str( test )

            config_file.write(config_text)
            config_file.close()    
Beispiel #2
0
    def __init__(self, targets, options):
        super(FamilyConfigMode, self).__init__(targets, options)

        # Provide subclasses the occasion to process test after loading but
        # before writing back the config file. Intended for more 'general'
        # use than test_hook() which applies to a sole given test.
        self.setup()

        for (family, test_list) in Test._families_map.iteritems():
            config_path = config_file_path(family)
            if os.path.exists(config_path):
                toolkit.keep_a_timed_version(config_path)

            config_file = open(config_path, 'w')

            config_text = ('"""Pytest config file.\n\n%s\n"""' %
                           toolkit.doc(Test))

            for test in test_list:
                self.test_hook(test)
                config_text += "\n%s\n" % str(test)

            config_file.write(config_text)
            config_file.close()
Beispiel #3
0
 def description(cls):
     return toolkit.doc(cls.RoutineType)
Beispiel #4
0
    print '    del bind[3]'
    print '    bind[3] = "newC"'
    _print_bindings(bind)    

def _test_iterators():
    print "#####  Testing iterators (hence ordering again...)"    

    list_of_pairs = [(1, "a"), (2, "b"), (3, "c"), (4, "d")]
    bindings = Bindings(list_of_pairs)

    iterkeys   = bindings.iterkeys()
    itervalues = bindings.itervalues()
    iteritems  = bindings.iteritems()
    for pair in list_of_pairs:
        assert pair[0] == iterkeys.next()
        assert pair[1] == itervalues.next()
        assert pair    == iteritems.next()
    print "Success!"
    print "\n"

if __name__ == "__main__":
    print "\nEmbedded test/tutorial for Bindings.py.\n"

    print "Bindings: "
    print doc(Bindings)
    print 
    
    _test_ctors()
    _test_ordering()
    _test_iterators()
Beispiel #5
0
 def description( cls ):
     return toolkit.doc( cls )
Beispiel #6
0
 def description( cls ):
     return toolkit.doc( cls.RoutineType )
Beispiel #7
0
 def description(cls):
     return toolkit.doc(cls)
Beispiel #8
0
    _print_bindings(bind)


def _test_iterators():
    print "#####  Testing iterators (hence ordering again...)"

    list_of_pairs = [(1, "a"), (2, "b"), (3, "c"), (4, "d")]
    bindings = Bindings(list_of_pairs)

    iterkeys = bindings.iterkeys()
    itervalues = bindings.itervalues()
    iteritems = bindings.iteritems()
    for pair in list_of_pairs:
        assert pair[0] == iterkeys.next()
        assert pair[1] == itervalues.next()
        assert pair == iteritems.next()
    print "Success!"
    print "\n"


if __name__ == "__main__":
    print "\nEmbedded test/tutorial for Bindings.py.\n"

    print "Bindings: "
    print doc(Bindings)
    print

    _test_ctors()
    _test_ordering()
    _test_iterators()