Skip to content
Snippets Groups Projects
Commit caab071d authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

patch threading without breaking everything

parent 3a374cd2
No related branches found
No related tags found
No related merge requests found
import smtplib import smtplib
import threading
import logging import logging
from threading import Thread
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
from typing import Sequence, Union from typing import Sequence, Union
...@@ -68,7 +69,7 @@ def send_mail( ...@@ -68,7 +69,7 @@ def send_mail(
# spin off a thread since this can take some time.. # spin off a thread since this can take some time..
logger.debug('Sending email') logger.debug('Sending email')
thread = threading.Thread(target=_send_mail, args=(smtp_server, port, recipients, message)) thread = Thread(target=_send_mail, args=(smtp_server, port, recipients, message))
thread.start() thread.start()
......
...@@ -47,7 +47,7 @@ def test_signup_email_admin(app, mocked_admin_user, mocker): ...@@ -47,7 +47,7 @@ def test_signup_email_admin(app, mocked_admin_user, mocker):
assert decoded == message assert decoded == message
mocker.patch('compendium_v2.email._send_mail', _send_mail) mocker.patch('compendium_v2.email._send_mail', _send_mail)
mocker.patch('threading.Thread', MockedThread) mocker.patch('compendium_v2.email.Thread', MockedThread)
with test_user(app) as user: with test_user(app) as user:
send_admin_signup_notification(user) send_admin_signup_notification(user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment