Skip to content

Commit

Permalink
Fix broken test on Python 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasLM committed Feb 19, 2018
1 parent 8b8fae5 commit c84f97d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/test_redis_brokers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ def test_running_job(mock_eb, broker):
assert broker._r.hget(running_jobs_key, str(job.id)) is None
broker.get_job_from_queue('foo_queue')
job.status = JobStatus.RUNNING
assert Job.deserialize(broker._r.hget(running_jobs_key, str(job.id))) == job
assert (
Job.deserialize(broker._r.hget(running_jobs_key, str(job.id)).decode())
== job
)

# Idempotent job - re-enqueue after job ran with error
broker.job_ran(job, err=ZeroDivisionError())
assert broker._r.hget(running_jobs_key, str(job.id)) is None
broker.get_job_from_queue('foo_queue')
job.status = JobStatus.RUNNING
assert Job.deserialize(broker._r.hget(running_jobs_key, str(job.id))) == job
assert (
Job.deserialize(broker._r.hget(running_jobs_key, str(job.id)).decode())
== job
)

# Idempotent job - job succeeded
broker.job_ran(job, err=None)
Expand All @@ -66,7 +72,10 @@ def test_running_job(mock_eb, broker):
job.retries = 999
broker.enqueue_job(job)
job = broker.get_job_from_queue('foo_queue')
assert Job.deserialize(broker._r.hget(running_jobs_key, str(job.id))) == job
assert (
Job.deserialize(broker._r.hget(running_jobs_key, str(job.id)).decode())
== job
)
broker.job_ran(job, err=ZeroDivisionError())
assert broker._r.hget(running_jobs_key, str(job.id)) is None
assert job.status == JobStatus.FAILED

0 comments on commit c84f97d

Please sign in to comment.