Skip to content

Commit

Permalink
Merge pull request #15 from mikemill/python2
Browse files Browse the repository at this point in the history
Add support for Python 2.7
  • Loading branch information
mikemill committed Sep 25, 2016
2 parents a116f2b + cb698d4 commit d711b59
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: python

python:
- "2.7"
- "3.4"
- "3.5"

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ pytest-mock
pytest-env
pytest-flake8
coveralls
pytz; python_version <= '2.7'
2 changes: 1 addition & 1 deletion rq_retry_scheduler/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def enqueue_job(self, job, pipeline=None, at_front=False):
enqueue_at = job.meta.pop('enqueue_at', None)

if not enqueue_at:
return super().enqueue_job(job, pipeline, at_front)
return super(Queue, self).enqueue_job(job, pipeline, at_front)

self.schedule_job(job, enqueue_at)

Expand Down
4 changes: 2 additions & 2 deletions rq_retry_scheduler/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def __init__(self, queues, queue_class=None, connection=None,
q(queue.name) if isinstance(queue, rq.Queue) else queue
for queue in rq.utils.ensure_list(queues)]

super().__init__(queues, *args, queue_class=queue_class,
connection=connection, **kwargs)
super(Worker, self).__init__(queues, *args, queue_class=queue_class,
connection=connection, **kwargs)

self.log = logger
self.push_exc_handler(self.exc_handler)
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def long_description():

setup(
name='rq-retry-scheduler',
version='0.1.0b5',
version='0.1.0b6',
url='https://github.com/mikemill/rq_retry_scheduler',
description='RQ Retry and Scheduler',
long_description=long_description(),
Expand All @@ -32,6 +32,8 @@ def long_description():
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
]
)
17 changes: 12 additions & 5 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
from datetime import datetime, timezone, timedelta
from datetime import datetime

from rq_retry_scheduler import util


def test_to_unix():
try:
from datetime import timezone, timedelta
utc = timezone.utc
pdt = timezone(timedelta(hours=-7))
except ImportError:
import pytz
utc = pytz.utc
pdt = pytz.timezone('Etc/GMT+7') # POSIX flips the sign


def test_to_unix():
tests = {
datetime(1970, 1, 1, 0, 0, 0, tzinfo=timezone.utc): 0,
datetime(2038, 1, 19, 3, 14, 7, tzinfo=timezone.utc): 2147483647,
datetime(1970, 1, 1, 0, 0, 0, tzinfo=utc): 0,
datetime(2038, 1, 19, 3, 14, 7, tzinfo=utc): 2147483647,
datetime(2016, 9, 17, 11, 26, 48, tzinfo=pdt): 1474136808,
}

Expand Down

0 comments on commit d711b59

Please sign in to comment.