Skip to content

Commit

Permalink
Fix a test
Browse files Browse the repository at this point in the history
  • Loading branch information
lw committed Jan 6, 2014
1 parent 8492e4a commit 5d79f90
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cmstestsuite/unit_tests/service/WorkerTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,19 @@ def test_execute_job_group_subsequent_locked(self):
that should fail because of the lock.
"""
jobgroup_a, calls_a = TestWorker.new_jobgroup(1, prefix="a")
# Because of how gevent works, the interval here can be very small.
task_type_a = FakeTaskType([0.01])
cms.service.Worker.get_task_type = Mock(return_value=task_type_a)
task_type = FakeTaskType([0.01])
cms.service.Worker.get_task_type = Mock(return_value=task_type)

jobgroup_a, calls_a = TestWorker.new_jobgroup(1, prefix="a")
jobgroup_b, calls_b = TestWorker.new_jobgroup(1, prefix="b")

def first_call():
JobGroup.import_from_dict(
self.service.execute_job_group(jobgroup_a.export_to_dict()))

first_greenlet = gevent.spawn(first_call)
gevent.sleep(0) # To ensure we call jobgroup a first.

jobgroup_b, calls_b = TestWorker.new_jobgroup(1, prefix="b")
task_type_b = FakeTaskType([True])
cms.service.Worker.get_task_type = Mock(return_value=task_type_b)
gevent.sleep(0) # To ensure we call jobgroup_a first.

try:
JobGroup.import_from_dict(
Expand Down

0 comments on commit 5d79f90

Please sign in to comment.