def setUp(self): self.l = [] self.startport = 4088 for i in range(self.num): self.l.append( Khashmir('127.0.0.1', self.startport + i, '/tmp/%s.test' % (self.startport + i))) reactor.iterate() reactor.iterate() for i in self.l: i.addContact('127.0.0.1', self.l[randrange(0, self.num)].port) i.addContact('127.0.0.1', self.l[randrange(0, self.num)].port) i.addContact('127.0.0.1', self.l[randrange(0, self.num)].port) reactor.iterate() reactor.iterate() reactor.iterate() for i in self.l: self.done = 0 i.findCloseNodes(self._done) while not self.done: reactor.iterate() for i in self.l: self.done = 0 i.findCloseNodes(self._done) while not self.done: reactor.iterate()
def __init__(self): BigWorld.Base.__init__(self) print "Base: Guard.__init__" self.cellData["position"] = (whrandom.randrange(-1, 1), 0, whrandom.randrange(-1, 1)) self.createInDefaultSpace()
def testStoreRetrieve(self): for i in range(10): K = khash.newID() V = khash.newID() for a in range(3): self.done = 0 def _scb(val): self.done = 1 self.l[randrange(0, self.num)].storeValueForKey(K, V, _scb) while not self.done: reactor.iterate() def _rcb(val): if not val: self.done = 1 self.assertEqual(self.got, 1) elif V in val: self.got = 1 for x in range(3): self.got = 0 self.done = 0 self.l[randrange(0, self.num)].valueForKey(K, _rcb) while not self.done: reactor.iterate()
def setUp(self): self.l = [] self.startport = 4088 for i in range(self.num): self.l.append(Khashmir('127.0.0.1', self.startport + i, '/tmp/%s.test' % (self.startport + i))) reactor.iterate() reactor.iterate() for i in self.l: i.addContact('127.0.0.1', self.l[randrange(0,self.num)].port) i.addContact('127.0.0.1', self.l[randrange(0,self.num)].port) i.addContact('127.0.0.1', self.l[randrange(0,self.num)].port) reactor.iterate() reactor.iterate() reactor.iterate() for i in self.l: self.done = 0 i.findCloseNodes(self._done) while not self.done: reactor.iterate() for i in self.l: self.done = 0 i.findCloseNodes(self._done) while not self.done: reactor.iterate()
def setUp(self): self.kfiles() self.l = [] for i in range(self.num): self.l.append(Khashmir('', self.startport + i, '/tmp/kh%s.db' % (self.startport + i))) reactor.iterate() reactor.iterate() for i in self.l: i.addContact(self.localip, self.l[randrange(0,self.num)].port) i.addContact(self.localip, self.l[randrange(0,self.num)].port) i.addContact(self.localip, self.l[randrange(0,self.num)].port) reactor.iterate() reactor.iterate() reactor.iterate() for i in self.l: self.done = 0 i.findCloseNodes(self._done) while not self.done: reactor.iterate() for i in self.l: self.done = 0 i.findCloseNodes(self._done) while not self.done: reactor.iterate()
def setUp(self): self.kfiles() self.l = [] for i in range(self.num): self.l.append( Khashmir('', self.startport + i, '/tmp/kh%s.db' % (self.startport + i))) reactor.iterate() reactor.iterate() for i in self.l: i.addContact(self.localip, self.l[randrange(0, self.num)].port) i.addContact(self.localip, self.l[randrange(0, self.num)].port) i.addContact(self.localip, self.l[randrange(0, self.num)].port) reactor.iterate() reactor.iterate() reactor.iterate() for i in self.l: self.done = 0 i.findCloseNodes(self._done) while not self.done: reactor.iterate() for i in self.l: self.done = 0 i.findCloseNodes(self._done) while not self.done: reactor.iterate()
def cookieFunction(): return COOKIES[whrandom.randrange(0, len(COOKIES))]
def randomFunction(): return str(whrandom.randrange(0, 100))
def timerEvent(self, ev): self.pixmap.update(whrandom.randrange(0, 300)) bitBlt(self, 0, 0, self.pixmap, 0, 0, self.width(), self.height())