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,6 +7,8 @@ from django.conf import settings | ||
7 | 7 | ||
8 | TIMEOUT = 1 | 8 | TIMEOUT = 1 |
9 | 9 | ||
10 | +LOGGER = logging.getLogger('colab.mailman') | ||
11 | + | ||
10 | 12 | ||
11 | def get_url(listname=None): | 13 | def get_url(listname=None): |
12 | if listname: | 14 | if listname: |
@@ -20,7 +22,7 @@ def subscribe(listname, address): | @@ -20,7 +22,7 @@ def subscribe(listname, address): | ||
20 | try: | 22 | try: |
21 | requests.put(url, timeout=TIMEOUT, data={'address': address}) | 23 | requests.put(url, timeout=TIMEOUT, data={'address': address}) |
22 | except: | 24 | except: |
23 | - logging.exception('Unable to subscribe user') | 25 | + LOGGER.exception('Unable to subscribe user') |
24 | return False | 26 | return False |
25 | return True | 27 | return True |
26 | 28 | ||
@@ -30,7 +32,7 @@ def unsubscribe(listname, address): | @@ -30,7 +32,7 @@ def unsubscribe(listname, address): | ||
30 | try: | 32 | try: |
31 | requests.delete(url, timeout=TIMEOUT, data={'address': address}) | 33 | requests.delete(url, timeout=TIMEOUT, data={'address': address}) |
32 | except: | 34 | except: |
33 | - logging.exception('Unable to unsubscribe user') | 35 | + LOGGER.exception('Unable to unsubscribe user') |
34 | return False | 36 | return False |
35 | return True | 37 | return True |
36 | 38 | ||
@@ -56,7 +58,7 @@ def address_lists(address, description=''): | @@ -56,7 +58,7 @@ def address_lists(address, description=''): | ||
56 | try: | 58 | try: |
57 | lists = requests.get(url, timeout=TIMEOUT, params=params) | 59 | lists = requests.get(url, timeout=TIMEOUT, params=params) |
58 | except: | 60 | except: |
59 | - logging.exception('Unable to list mailing lists') | 61 | + LOGGER.exception('Unable to list mailing lists') |
60 | return [] | 62 | return [] |
61 | 63 | ||
62 | return lists.json() | 64 | return lists.json() |
colab/tests/settings.py
1 | from ..settings import * | 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 | import os | 29 | import os |
5 | HAYSTACK_CONNECTIONS = { | 30 | HAYSTACK_CONNECTIONS = { |