def setUp(self): conf = ConfigParser() conf.read('test.cfg') if conf.sections() == ['Test']: self.ps = thoonk.Thoonk(host=conf.get('Test', 'host'), port=conf.getint('Test', 'port'), db=conf.getint('Test', 'db')) self.ps.redis.flushdb() else: print 'No test configuration found in test.cfg' exit()
def setUp(self): self.thoonk = thoonk.Thoonk(CONFIG['host'], CONFIG['port'], CONFIG['db']) self.driver_queue = self.thoonk.queue('interop-testing-driver') self.follower_queue = self.thoonk.queue('interop-testing-follower')
if __name__ == '__main__': optp = OptionParser() optp.add_option('-s', '--server', help='set Redis host', dest='server', default='localhost') optp.add_option('-p', '--port', help='set Redis host', dest='port', default=6379) optp.add_option('-d', '--db', help='set Redis db', dest='db', default=10) opts, args = optp.parse_args() CONFIG['host'] = opts.server CONFIG['port'] = opts.port CONFIG['db'] = opts.db if args[0] == 'driver': t = thoonk.Thoonk(opts.server, opts.port, opts.db) t.redis.flushdb() test_class = TestInteropDriver else: test_class = TestInteropFollower suite = unittest.TestLoader().loadTestsFromTestCase(test_class) unittest.TextTestRunner(verbosity=2).run(suite)