diff --git a/.travis.yml b/.travis.yml index 174e317..0953c81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,12 +3,12 @@ language: python sudo: no python: - - "2.6" - "2.7" - "3.3" - "3.4" - "3.5" - "3.6" + - "3.7" script: py.test --cov emails diff --git a/emails/compat/__init__.py b/emails/compat/__init__.py index f116c19..9f301e1 100644 --- a/emails/compat/__init__.py +++ b/emails/compat/__init__.py @@ -118,7 +118,14 @@ def to_bytes(x, charset=sys.getdefaultencoding(), errors='strict'): elif is_py3: import urllib.parse as urlparse - from collections import OrderedDict, Callable + + try: + from collections.abc import Callable + except ImportError: + from collections import Callable + + from collections import OrderedDict + from io import StringIO, BytesIO NativeStringIO = StringIO diff --git a/emails/testsuite/conftest.py b/emails/testsuite/conftest.py index acb3b3e..e3495b8 100644 --- a/emails/testsuite/conftest.py +++ b/emails/testsuite/conftest.py @@ -13,6 +13,8 @@ logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger() +import cssutils +cssutils.log.setLevel(logging.FATAL) @pytest.fixture(scope='module') def django_email_backend(request): diff --git a/emails/testsuite/loader/test_helpers.py b/emails/testsuite/loader/test_helpers.py index 623be22..9c7eea7 100644 --- a/emails/testsuite/loader/test_helpers.py +++ b/emails/testsuite/loader/test_helpers.py @@ -1,6 +1,8 @@ # encoding: utf-8 from __future__ import unicode_literals, print_function +import logging; import cssutils; cssutils.log.setLevel(logging.FATAL) + from emails.loader.helpers import (guess_charset, guess_text_charset, decode_text, guess_html_charset, RULES_U) diff --git a/emails/testsuite/loader/test_loaders.py b/emails/testsuite/loader/test_loaders.py index 2069df7..e8c88b6 100644 --- a/emails/testsuite/loader/test_loaders.py +++ b/emails/testsuite/loader/test_loaders.py @@ -22,10 +22,9 @@ from_file='data/html_import/oldornament/oldornament/index.html', from_zip='data/html_import/oldornament/oldornament.zip') - def test__from_html(): - with pytest.raises(XMLSyntaxError): + with pytest.raises(Exception): emails.loader.from_html(html='') assert '-X-' in emails.loader.from_html(html='-X-').html @@ -169,10 +168,10 @@ def test_external_urls(): success = 0 for url in [ - 'http://yandex.com', - 'http://www.smashingmagazine.com/' + 'https://news.ycombinator.com/', + 'https://www.python.org/' ]: - print("test_external_urls: %s" % url) + print("test_external_urls: url=%s" % url) try: emails.loader.from_url(url) success += 1 diff --git a/emails/testsuite/smtp_servers.py b/emails/testsuite/smtp_servers.py index eee5d37..2a80c61 100644 --- a/emails/testsuite/smtp_servers.py +++ b/emails/testsuite/smtp_servers.py @@ -32,6 +32,6 @@ def as_bool(value, default=False): 'mx.yandex.ru': dict(from_email=_from, to_email=_to, host='mx.yandex.ru', port=25, tls=False), - 'outlook.com': dict(from_email=_from, to_email='lavr@outlook.com', - host='mx1.hotmail.com'), + #'outlook.com': dict(from_email=_from, to_email='lavr@outlook.com', + # host='smtp-mail.outlook.com', port=587, tls=True), } diff --git a/tox.ini b/tox.ini index 1df4633..3ed1f1d 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py26, py27, py33, py34, py35, py36, pypy +envlist = py27, py33, py34, py35, py36, py37, pypy [testenv] passenv = TEST_*