diff options
| author | Vincent Driessen <vincent@3rdcloud.com> | 2013-09-16 04:53:12 -0700 |
|---|---|---|
| committer | Vincent Driessen <vincent@3rdcloud.com> | 2013-09-16 04:53:12 -0700 |
| commit | 561635298ddc5da7c1f39c27fc179d4713faec58 (patch) | |
| tree | 1ea8c1148dd8be46346a37a8a79adc115823dff7 | |
| parent | 5b2cf39bb29fbd87fe8796b410d3eb2032520e59 (diff) | |
| parent | 320dc6893868b0283181db5f666519b9752a6fc3 (diff) | |
| download | rq-scheduler-integration.tar.gz | |
Merge pull request #258 from selwin/scheduler-integrationscheduler-integration
Fixed scheduler related tests on Py3k.
| -rw-r--r-- | rq/job.py | 6 | ||||
| -rw-r--r-- | tests/test_scheduler.py | 2 | ||||
| -rw-r--r-- | tests/test_worker.py | 3 |
3 files changed, 6 insertions, 5 deletions
@@ -193,7 +193,7 @@ class Job(object): def __init__(self, id=None, connection=None): self.connection = resolve_connection(connection) - self._id = id + self._id = as_text(id) self.created_at = times.now() self._func_name = None self._instance = None @@ -223,7 +223,7 @@ class Job(object): def set_id(self, value): """Sets a job ID for the given job.""" - self._id = value + self._id = as_text(value) id = property(get_id, set_id) @@ -235,7 +235,7 @@ class Job(object): @classmethod def waitlist_key_for(cls, job_id): """The Redis key that is used to store job hash under.""" - return 'rq:job:%s:waitlist' % as_text(job_id).encode('utf-8') + return b'rq:job:' + as_text(job_id).encode('utf-8') + b':waitlist' @property def key(self): diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 79d3522..2af3657 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -100,7 +100,7 @@ class TestScheduler(RQTestCase): Ensure get_jobs() returns all jobs until the specified time. """ now = times.now() - job = self.scheduler.enqueue_at(now, say_hello) + job = self.scheduler.enqueue_at(now, say_hello) self.assertIn(job, self.scheduler.get_jobs(now)) future_time = now + timedelta(hours=1) job = self.scheduler.enqueue_at(future_time, say_hello) diff --git a/tests/test_worker.py b/tests/test_worker.py index 67f0210..dcafde1 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -5,6 +5,7 @@ from tests.fixtures import say_hello, div_by_zero, do_nothing, create_file, \ create_file_after_timeout from tests.helpers import strip_milliseconds from rq import Queue, Worker, get_failed_queue +from rq.compat import as_text from rq.job import Job, Status @@ -186,7 +187,7 @@ class TestWorker(RQTestCase): # TODO: Having to do the manual refresh() here is really ugly! res.refresh() - self.assertIn('JobTimeoutException', res.exc_info) + self.assertIn('JobTimeoutException', as_text(res.exc_info)) def test_worker_sets_result_ttl(self): """Ensure that Worker properly sets result_ttl for individual jobs.""" |
