Ejemplo n.º 1
0
    print 'Results: %d (%.0f%%) OK, %d (%.0f%%) warnings, %d (%.0f%%) failed' \
        % (results['ok'], 100 * float(results['ok']) / total,
            results['warnings'], 100 * float(results['warnings']) / total,
            results['errors'], 100 * float(results['errors']) / total,)

if __name__ == '__main__':
    from optparse import OptionParser
    
    parser = OptionParser('%prog [pattern ...]')
    parser.add_option('-p', '--profile', metavar='NAME',
        help='the instrument profile to use')
    parser.add_option('-d', '--debug', action='store_true',
        help='show debugging information')
    parser.add_option('-l', '--live', action='store_true',
        help="don't use recordings; ask for live playing instead")
    parser.set_defaults(profile='piano', live=False, debug=False)
    
    options, args = parser.parse_args()
    
    try:
        set_test_profile(load_profile(options.profile))
    except IOError, e:
        parser.error('failed to load profile %r: %s' %
            (options.profile, e.args[1]))
    
    tests = load_tests()
    if len(args) > 0:
        tests = filter_tests(tests, args)
    
    run_tests(tests, options.debug)
Ejemplo n.º 2
0
            if len(notes) == 1:
                return color('green', str(list(notes)[0]))
            else:
                return color('yellow', '(%s)' %
                    (' | '.join(map(str, sorted(notes)))))
        
        output = ', '.join(describe(result) for result in results) if results \
            else color('red', '----')
        
        print '    ' + output
        
        if not results:
            print interpreter._note_to_result
            print interpreter._component_to_result
    
    interpreter = Interpreter(show_results, load_profile('playground'))
    
    emitter = NoteEventEmitter(listener, interpreter.event)
    
    emitter.start()
    try:
        while True:
            try:
                sleep(0.2)
            except Empty:
                continue
    except KeyboardInterrupt:
        print
    finally:
        emitter.stop()