Commit 9cfb635b9d1a1aadb3e63acfad223e8e3f15810a
1 parent
8c2094ee
Exists in
master
and in
39 other branches
Silent mailman error logs for tests
Showing
2 changed files
with
30 additions
and
3 deletions
Show diff stats
colab/accounts/utils/mailman.py
| ... | ... | @@ -7,6 +7,8 @@ from django.conf import settings |
| 7 | 7 | |
| 8 | 8 | TIMEOUT = 1 |
| 9 | 9 | |
| 10 | +LOGGER = logging.getLogger('colab.mailman') | |
| 11 | + | |
| 10 | 12 | |
| 11 | 13 | def get_url(listname=None): |
| 12 | 14 | if listname: |
| ... | ... | @@ -20,7 +22,7 @@ def subscribe(listname, address): |
| 20 | 22 | try: |
| 21 | 23 | requests.put(url, timeout=TIMEOUT, data={'address': address}) |
| 22 | 24 | except: |
| 23 | - logging.exception('Unable to subscribe user') | |
| 25 | + LOGGER.exception('Unable to subscribe user') | |
| 24 | 26 | return False |
| 25 | 27 | return True |
| 26 | 28 | |
| ... | ... | @@ -30,7 +32,7 @@ def unsubscribe(listname, address): |
| 30 | 32 | try: |
| 31 | 33 | requests.delete(url, timeout=TIMEOUT, data={'address': address}) |
| 32 | 34 | except: |
| 33 | - logging.exception('Unable to unsubscribe user') | |
| 35 | + LOGGER.exception('Unable to unsubscribe user') | |
| 34 | 36 | return False |
| 35 | 37 | return True |
| 36 | 38 | |
| ... | ... | @@ -56,7 +58,7 @@ def address_lists(address, description=''): |
| 56 | 58 | try: |
| 57 | 59 | lists = requests.get(url, timeout=TIMEOUT, params=params) |
| 58 | 60 | except: |
| 59 | - logging.exception('Unable to list mailing lists') | |
| 61 | + LOGGER.exception('Unable to list mailing lists') | |
| 60 | 62 | return [] |
| 61 | 63 | |
| 62 | 64 | return lists.json() | ... | ... |
colab/tests/settings.py
| 1 | 1 | from ..settings import * |
| 2 | 2 | |
| 3 | +LOGGING = { | |
| 4 | + 'version': 1, | |
| 5 | + | |
| 6 | + 'handlers': { | |
| 7 | + 'null': { | |
| 8 | + 'level': 'DEBUG', | |
| 9 | + 'class': 'logging.NullHandler', | |
| 10 | + }, | |
| 11 | + }, | |
| 12 | + | |
| 13 | + 'loggers': { | |
| 14 | + 'colab.mailman': { | |
| 15 | + 'handlers': ['null'], | |
| 16 | + 'propagate': False, | |
| 17 | + }, | |
| 18 | + 'haystack': { | |
| 19 | + 'handlers': ['null'], | |
| 20 | + 'propagate': False, | |
| 21 | + }, | |
| 22 | + 'pysolr': { | |
| 23 | + 'handlers': ['null'], | |
| 24 | + 'propagate': False, | |
| 25 | + }, | |
| 26 | + }, | |
| 27 | +} | |
| 3 | 28 | |
| 4 | 29 | import os |
| 5 | 30 | HAYSTACK_CONNECTIONS = { | ... | ... |