Skip to content

Commit

Permalink
fixing tests with python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Dec 6, 2016
1 parent 6a8c7c3 commit 980f09a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ lint:

.PHONY: test
test:
py.test --cov=arq && coverage combine
TZ=Asia/Singapore pytest --cov=arq && coverage combine

.PHONY: .test-build-cov
.test-build-cov:
py.test --cov=arq && (echo "building coverage html"; coverage combine; coverage html)
TZ=Asia/Singapore pytest --cov=arq && (echo "building coverage html"; coverage combine; coverage html)

.PHONY: all
all: .test-build-cov lint
Expand Down
6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import os
from collections import OrderedDict
from datetime import datetime

Expand Down Expand Up @@ -39,9 +38,10 @@ def test_custom_settings():


def test_timestamp():
os.environ['TZ'] = 'Asia/Singapore'
# tests should always be run with TZ=Asia/Singapore
# check we've successfully changed the timezone
assert 7.99 < (datetime.now() - datetime.utcnow()).total_seconds() / 3600 < 8.01
assert 7.99 < (datetime.now() - datetime.utcnow()).total_seconds() / 3600 < 8.01, ('timezone not set to '
'Asia/Singapore')
unix_stamp = int(datetime.now().strftime('%s'))
assert abs(timestamp() - unix_stamp) < 2

Expand Down
3 changes: 1 addition & 2 deletions tests/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ async def test_job_timeout(loop, caplog):
'arq.jobs: dft ran in 0.05Xs ← MockRedisDemoActor.sleeper ● 0.05\n'
'arq.jobs: job timed out <Job MockRedisDemoActor.sleeper(0.2) on dft>\n'
'arq.jobs: dft ran in 0.10Xs ! MockRedisDemoActor.sleeper(0.2): CancelledError\n') in log
assert ('raise CancelledError\n'
'concurrent.futures._base.CancelledError\n'
assert ('concurrent.futures._base.CancelledError\n'
'arq.work: shutting down worker after 0.10Xs ◆ 2 jobs done ◆ 1 failed ◆ 1 timed out\n') in log


Expand Down

0 comments on commit 980f09a

Please sign in to comment.