Skip to content

Commit a994d5a

Browse files
liquidpeleauvipy
authored andcommitted
Fix up tests (#243)
* Fix up tests 1. add test runs for python 3.7, remove 3.4 2. fix 2.7 tests to not use celery versions that don't support it 3. add pytest-timeout to avoid hanging certain tests when broker is not running * Fix python 3.7 for travis-ci, fix flake8 error, move more things to 3.7 * yml formatting * Put the 3.7 options in the right location of the travis-ci.yml * celery python2 limit is 5.0 so properly set that. * Attempt to bend travis-ci to my will with python 3.7 * load python2 requriements for pypy * Properly match python version between tox.ini and travis.yml for doc/analysis tasks. * Use older version of django for doc/cov due to sqlite incompatibility * Fix a flake8 error, and fix django dependency for coverage * Try setting hostname on containers to fix rabbitmq-server on xenial * debugging rabbitmq on xenial in travis container * More python37 in travis-ci debugging * More python37 debugging * python37 try updating erlang to make rabbitmq work * Fix installation commands for erlang install on xenial * python37 also manually install celery from latest master, allow external commands * More python37 hackup fixing
1 parent 2acd6a2 commit a994d5a

File tree

11 files changed

+64
-17
lines changed

11 files changed

+64
-17
lines changed

.travis.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,32 @@ sudo: false
33
cache: false
44
python:
55
- 2.7
6-
- 3.4
76
- 3.5
87
- pypy
98
env:
109
- DJANGO=1.11
1110
- DJANGO=2.0
11+
- DJANGO=2.2
1212
os:
1313
- linux
1414
matrix:
1515
include:
16-
- { python: 2.7, env: TOXENV=flake8 }
16+
- {python: 3.7, env: DJANGO=1.11 TOXENV=python37, dist: xenial, sudo: true}
17+
- {python: 3.7, env: DJANGO=2.0 TOXENV=python37, dist: xenial, sudo: true}
18+
- {python: 3.7, env: DJANGO=2.2 TOXENV=python37, dist: xenial, sudo: true}
19+
- { python: 3.5, env: TOXENV=flake8 }
1720
- { python: 2.7, env: TOXENV=flakeplus }
18-
- { python: 2.7, env: TOXENV=pydocstyle }
19-
- { python: 3.5, env: TOXENV=apicheck }
20-
- { python: 3.5, env: TOXENV=linkcheck }
21+
- { python: 3.5, env: TOXENV=pydocstyle }
2122
- { python: 3.5, env: TOXENV=cov }
23+
# disabled temporarily due to upstream bug
24+
# https://github.com/celery/sphinx_celery/issues/9
25+
# - { python: 3.5, env: TOXENV=apicheck }
26+
# - { python: 3.5, env: TOXENV=linkcheck }
2227
exclude:
2328
- { python: 2.7, env: DJANGO=2.0 }
29+
- { python: 2.7, env: DJANGO=2.2 }
2430
- { python: pypy, env: DJANGO=2.0 }
31+
- { python: pypy, env: DJANGO=2.2 }
2532
install: travis_retry pip install -U tox-travis
2633
services: rabbitmq
2734
script: tox -v -- -v

django_celery_beat/schedulers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def sync(self):
295295
try:
296296
self.schedule[name].save()
297297
_tried.add(name)
298-
except (KeyError, ObjectDoesNotExist) as exc:
298+
except (KeyError, ObjectDoesNotExist):
299299
_failed.add(name)
300300
except DatabaseError as exc:
301301
logger.exception('Database error while sync: %r', exc)

requirements/default.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
celery>=4.0,<5.0
21
django-timezone-field>=2.0
32
python-crontab>=2.3.4

requirements/docs.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
Django==1.11
12
https://github.com/celery/sphinx_celery/archive/master.zip
2-
Django>=1.10
3+
https://github.com/celery/kombu/zipball/master#egg=kombu
4+
https://github.com/celery/celery/zipball/master#egg=celery

requirements/pkgutils.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ flakeplus>=1.1
55
tox>=2.3.1
66
sphinx2rst>=1.0
77
bumpversion
8-
pydocstyle
8+
pydocstyle

requirements/python2.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# celery stops supporting python2 at 5.0.0
2+
# thus for python2 tests we can't use latest master anymore
3+
celery<5.0.0

requirements/python3.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# for python3, install latest stuff
2+
https://github.com/celery/celery/zipball/master#egg=celery
3+
https://github.com/celery/kombu/zipball/master#egg=kombu

requirements/test-django20.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
django>=2.0,<2.1
1+
django>=2.0,<2.1

requirements/test.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
case>=1.3.1
2-
pytest>=3.0
32
pytest-django
43
pytz>dev
4+
pytest<4.0.0
5+
pytest-timeout

t/unit/test_schedulers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,9 @@ def patch_request(self, request):
652652
setattr(request, '_messages', messages)
653653
return request
654654

655+
# don't hang if broker is down
656+
# https://github.com/celery/celery/issues/4627
657+
@pytest.mark.timeout(5)
655658
def test_run_task(self):
656659
ma = PeriodicTaskAdmin(PeriodicTask, self.site)
657660
self.request = self.patch_request(self.request_factory.get('/'))
@@ -660,6 +663,9 @@ def test_run_task(self):
660663
queued_message = self.request._messages._queued_messages[0].message
661664
assert queued_message == '1 task was successfully run'
662665

666+
# don't hang if broker is down
667+
# https://github.com/celery/celery/issues/4627
668+
@pytest.mark.timeout(5)
663669
def test_run_tasks(self):
664670
ma = PeriodicTaskAdmin(PeriodicTask, self.site)
665671
self.request = self.patch_request(self.request_factory.get('/'))

0 commit comments

Comments
 (0)