Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(22)  |  Call(22)  |  Derive(0)  |  Import(0)

src/q/l/qless-py-0.10.1/test/test_worker.py   qless-py(Download)
        try:
            with Worker.sandbox(path):
                self.assertTrue(os.path.exists(path))
                for name in ['whiz', 'widget', 'bang']:
                    with open(os.path.join(path, name), 'w+'):
            pass
        # If we get to this point, the test succeeds
        self.assertTrue(True)
 
    def test_dirty_sandbox(self):
        queue.put('foo', {})
        job = self.worker.jobs().next()
        self.assertTrue(isinstance(job, qless.Job))
        # Now, we'll create a new worker and make sure it gets that job first
        worker = Worker(['foo'], self.client, resume=[job])
        other = qless.Client(hostname='other')
        job = other.queues['foo'].pop()
        self.assertTrue(isinstance(job, qless.Job))
        # Now, we'll create a new worker and make sure it gets that job first
        worker = Worker(

src/q/l/qless-py-HEAD/test/test_worker.py   qless-py(Download)
        try:
            with Worker.sandbox(path):
                self.assertTrue(os.path.exists(path))
                for name in ['whiz', 'widget', 'bang']:
                    with open(os.path.join(path, name), 'w+'):
            pass
        # If we get to this point, the test succeeds
        self.assertTrue(True)
 
    def test_dirty_sandbox(self):
        queue.put('foo', {})
        job = self.worker.jobs().next()
        self.assertTrue(isinstance(job, qless.Job))
        # Now, we'll create a new worker and make sure it gets that job first
        worker = Worker(['foo'], self.client, resume=[job])
        other = qless.Client(hostname='other')
        job = other.queues['foo'].pop()
        self.assertTrue(isinstance(job, qless.Job))
        # Now, we'll create a new worker and make sure it gets that job first
        worker = Worker(

src/q/l/qless-py-0.10.1/test/test_job.py   qless-py(Download)
        self.client.queues['foo'].put(Job, {}, jid='jid')
        self.client.queues['foo'].pop()
        self.assertTrue(self.client.jobs['jid'].ttl < 10)
        self.assertTrue(self.client.jobs['jid'].ttl > 9)
 
        self.client.config['heartbeat'] = 20
        job.heartbeat()
        self.assertTrue(job.ttl > before)
 
    def test_heartbeat_fail(self):
        self.assertFalse(self.client.jobs['jid'].tracked)
        self.client.jobs['jid'].track()
        self.assertTrue(self.client.jobs['jid'].tracked)
        self.client.jobs['jid'].untrack()
        self.assertFalse(self.client.jobs['jid'].tracked)
        nxt = self.client.jobs['jid'].next
        self.client.queues['foo'].pop()
        self.assertTrue(abs(self.client.jobs['jid'].next - nxt - 60) < 1)
 
    def test_attribute_error(self):

src/q/l/qless-py-HEAD/test/test_job.py   qless-py(Download)
        self.client.queues['foo'].put(Job, {}, jid='jid')
        self.client.queues['foo'].pop()
        self.assertTrue(self.client.jobs['jid'].ttl < 10)
        self.assertTrue(self.client.jobs['jid'].ttl > 9)
 
        self.client.config['heartbeat'] = 20
        job.heartbeat()
        self.assertTrue(job.ttl > before)
 
    def test_heartbeat_fail(self):
        self.assertFalse(self.client.jobs['jid'].tracked)
        self.client.jobs['jid'].track()
        self.assertTrue(self.client.jobs['jid'].tracked)
        self.client.jobs['jid'].untrack()
        self.assertFalse(self.client.jobs['jid'].tracked)
        nxt = self.client.jobs['jid'].next
        self.client.queues['foo'].pop()
        self.assertTrue(abs(self.client.jobs['jid'].next - nxt - 60) < 1)
 
    def test_attribute_error(self):

src/q/l/qless-core-HEAD/test/test_locks.py   qless-core(Download)
        # We should see our expiration update after a heartbeat
        self.assertTrue(
            self.lua('heartbeat', 3, 'jid', 'worker', {}) > job['expires'])
 
    def test_heartbeat_waiting(self):

src/q/l/qless-core-HEAD/test/test_worker.py   qless-core(Download)
        for worker in workers:
            found = [w['name'] for w in self.lua('workers', 2)]
            self.assertTrue(worker in found)
            self.lua('worker.deregister', 2, worker)
            found = [w['name'] for w in self.lua('workers', 2)]

src/q/l/qless-py-0.10.1/test/test_config.py   qless-py(Download)
    def test_contains(self):
        '''We can use the 'in' syntax'''
        self.assertFalse('foo' in self.client.config)
        self.client.config['foo'] = 5
        self.assertTrue('foo' in self.client.config)

src/q/l/qless-py-HEAD/test/test_config.py   qless-py(Download)
    def test_contains(self):
        '''We can use the 'in' syntax'''
        self.assertFalse('foo' in self.client.config)
        self.client.config['foo'] = 5
        self.assertTrue('foo' in self.client.config)