Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gotcha committed Oct 4, 2012
1 parent c06baff commit f1a9004
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/five/taskqueue/tests/processor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ API. Let's create the necessary components to test the processor:

1. Create the task service and add it to the root site:

>>> import transaction
>>> transaction.abort()
>>> from five.taskqueue import service
>>> tasks = service.TaskService()
>>> tasks.id = 'tasks'
Expand Down Expand Up @@ -44,6 +46,9 @@ API. Let's create the necessary components to test the processor:

>>> import zope.component
>>> zope.component.provideUtility(sleepTask, name='sleep')

4. Setup reference of global DB on service

>>> import Zope2
>>> from z3c.taskqueue.startup import storeDBReference
>>> storeDBReference(Zope2.DB)
Expand All @@ -63,7 +68,6 @@ Let's first register a few tasks:
>>> jobid = tasks.add(u'sleep', (0.1, 2))
>>> jobid = tasks.add(u'sleep', (0, 3))
>>> jobid = tasks.add(u'sleep', (0.08, 4))
>>> import transaction
>>> transaction.commit()

Let's start by executing a job directly. The first argument to the simple
Expand All @@ -75,7 +79,7 @@ the task service. All other arguments are optional:
>>> proc = processor.SimpleProcessor(
... db, tasks.getServicePath(), waitTime=0.0)

Let's now process the first job. We clear the log.
Let's now process the first job. We first clear the log.

>>> log_info.clear()

Expand Down
6 changes: 3 additions & 3 deletions src/five/taskqueue/tests/test_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ def tearDown(self):
random.seed()

def test_sequence(self):
id = 8852258758999665121
id = 1392637175
self.assertEquals(id, self.service._generateId())
self.assertEquals(id + 1, self.service._generateId())
self.assertEquals(id + 2, self.service._generateId())
self.assertEquals(id + 3, self.service._generateId())

def test_in_use_randomises(self):
id = 8852258758999665121
id = 1392637175
self.assertEquals(id, self.service._generateId())
self.service.jobs[id + 1] = object()
id = 5113777911774377050
id = 1506179619
self.assertEquals(id, self.service._generateId())
self.assertEquals(id + 1, self.service._generateId())
self.service.jobs[id + 1] = object()
Expand Down

0 comments on commit f1a9004

Please sign in to comment.