|
|
@ -5,6 +5,7 @@ from __future__ import (absolute_import, division, print_function,
|
|
|
|
from datetime import datetime
|
|
|
|
from datetime import datetime
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from Queue import Queue
|
|
|
|
from tests import fixtures, RQTestCase
|
|
|
|
from tests import fixtures, RQTestCase
|
|
|
|
from tests.helpers import strip_microseconds
|
|
|
|
from tests.helpers import strip_microseconds
|
|
|
|
|
|
|
|
|
|
|
@ -292,6 +293,13 @@ class TestJob(RQTestCase):
|
|
|
|
serialized2.pop('meta')
|
|
|
|
serialized2.pop('meta')
|
|
|
|
self.assertDictEqual(serialized, serialized2)
|
|
|
|
self.assertDictEqual(serialized, serialized2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_unpickleable_result(self):
|
|
|
|
|
|
|
|
"""Unpickleable job result doesn't crash job.to_dict()"""
|
|
|
|
|
|
|
|
job = Job.create(func=fixtures.say_hello, args=('Lionel',))
|
|
|
|
|
|
|
|
job._result = Queue()
|
|
|
|
|
|
|
|
data = job.to_dict()
|
|
|
|
|
|
|
|
self.assertEqual(data['result'], 'Unpickleable return value')
|
|
|
|
|
|
|
|
|
|
|
|
def test_result_ttl_is_persisted(self):
|
|
|
|
def test_result_ttl_is_persisted(self):
|
|
|
|
"""Ensure that job's result_ttl is set properly"""
|
|
|
|
"""Ensure that job's result_ttl is set properly"""
|
|
|
|
job = Job.create(func=fixtures.say_hello, args=('Lionel',), result_ttl=10)
|
|
|
|
job = Job.create(func=fixtures.say_hello, args=('Lionel',), result_ttl=10)
|
|
|
|