Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail when running from home #87

Open
vfaronov opened this issue Jul 7, 2017 · 2 comments
Open

Tests fail when running from home #87

vfaronov opened this issue Jul 7, 2017 · 2 comments

Comments

@vfaronov
Copy link

vfaronov commented Jul 7, 2017

The following two tests:

  • emails/testsuite/message/test_send.py::test_send_letters
  • emails/testsuite/smtp/test_smtp_backend.py::test_smtp_send_with_reconnect

fail on my system, apparently because Microsoft rejects mail from home ISPs like mine (OnLime = Rostelecom):

smtp_servers = {'gmail.com-tls': <emails.testsuite.conftest.SMTPTestParams object at 0x7ff6a8dbccc0>, 'mx.yandex.ru': <emails.testsui...stParams object at 0x7ff6a8dbcc18>, 'outlook.com': <emails.testsuite.conftest.SMTPTestParams object at 0x7ff6a8dbcbe0>}

    def test_send_letters(smtp_servers):
    
        for m, render in get_letters():
            for tag, server in smtp_servers.items():
                server.patch_message(m)
                response = m.send(smtp=server.params, render=render)
                print(server.params)
>               assert response.success or response.status_code in (421, 451)  # gmail not always like test emails
E               assert (False or 550 in (421, 451))
E                +  where False = <emails.backend.SMTPResponse status_code=550 status_text=b"DY-001 (COL004-MC2F34) Unfortunately, messages from 188.32....ically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.">.success
E                +  and   550 = <emails.backend.SMTPResponse status_code=550 status_text=b"DY-001 (COL004-MC2F34) Unfortunately, messages from 188.32....ically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.">.status_code

emails/testsuite/message/test_send.py:35: AssertionError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
{'timeout': 25, 'tls': True, 'fail_silently': True, 'port': 25, 'host': 'alt1.gmail-smtp-in.l.google.com', 'debug': 1}
{'fail_silently': True, 'timeout': 25, 'port': 25, 'host': 'mx.yandex.ru', 'debug': 1}
{'fail_silently': True, 'timeout': 25, 'host': 'mx1.hotmail.com', 'debug': 1}
-------------------------------------------------------- Captured stderr call ---------------------------------------------------------
[...skip...]
send: 'mail FROM:<python-emails@lavr.me> size=4203\r\n'
reply: b"550 DY-001 (COL004-MC2F34) Unfortunately, messages from [MY.IP.ADDRESS.HERE] weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.\r\n"
reply: retcode (550); Msg: b"DY-001 (COL004-MC2F34) Unfortunately, messages from [MY.IP.ADDRESS.HERE] weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors."
send: 'rset\r\n'

The other two SMTP servers are OK.

@vfaronov vfaronov changed the title test_send_letters fails when running from home Tests fail when running from home Jul 7, 2017
@lavr
Copy link
Owner

lavr commented Jul 7, 2017

May be I should just skip this tests on local tests (actually - run them only in Travis)...

@lavr
Copy link
Owner

lavr commented Jul 19, 2017

I've added some environment variables for testing, now you can use local smtp:

$ TEST_SMTP_HOST=localhost TEST_SMTP_PORT=1025 tox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants