Skip to content

Commit 980f09a

Browse files
committed
fixing tests with python 3.6
1 parent 6a8c7c3 commit 980f09a

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ lint:
1818

1919
.PHONY: test
2020
test:
21-
py.test --cov=arq && coverage combine
21+
TZ=Asia/Singapore pytest --cov=arq && coverage combine
2222

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

2727
.PHONY: all
2828
all: .test-build-cov lint

tests/test_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import os
32
from collections import OrderedDict
43
from datetime import datetime
54

@@ -39,9 +38,10 @@ def test_custom_settings():
3938

4039

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

tests/test_worker.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ async def test_job_timeout(loop, caplog):
217217
'arq.jobs: dft ran in 0.05Xs ← MockRedisDemoActor.sleeper ● 0.05\n'
218218
'arq.jobs: job timed out <Job MockRedisDemoActor.sleeper(0.2) on dft>\n'
219219
'arq.jobs: dft ran in 0.10Xs ! MockRedisDemoActor.sleeper(0.2): CancelledError\n') in log
220-
assert ('raise CancelledError\n'
221-
'concurrent.futures._base.CancelledError\n'
220+
assert ('concurrent.futures._base.CancelledError\n'
222221
'arq.work: shutting down worker after 0.10Xs ◆ 2 jobs done ◆ 1 failed ◆ 1 timed out\n') in log
223222

224223

0 commit comments

Comments
 (0)