From 1a31478a7a12a979d5cdf7b70a4059a30c49ff89 Mon Sep 17 00:00:00 2001 From: Sergey Lavrinenko Date: Fri, 5 Oct 2018 19:57:54 +0300 Subject: [PATCH 1/4] python 3.7 --- .travis.yml | 1 + emails/compat/__init__.py | 9 ++++++++- tox.ini | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 174e317..82ec21a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ python: - "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/tox.ini b/tox.ini index 1df4633..899af2c 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 = py26, py27, py33, py34, py35, py36, py37, pypy [testenv] passenv = TEST_* From bee415d731a8fc2b8535ff02a38554e373886f3e Mon Sep 17 00:00:00 2001 From: Sergey Lavrinenko Date: Fri, 5 Oct 2018 20:02:40 +0300 Subject: [PATCH 2/4] deprecate py2.6 --- .travis.yml | 1 - tox.ini | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82ec21a..0953c81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: python sudo: no python: - - "2.6" - "2.7" - "3.3" - "3.4" diff --git a/tox.ini b/tox.ini index 899af2c..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, py37, pypy +envlist = py27, py33, py34, py35, py36, py37, pypy [testenv] passenv = TEST_* From b8c3d2f740066d7a68b3b0285ca021806dc65730 Mon Sep 17 00:00:00 2001 From: Sergey Lavrinenko Date: Mon, 8 Oct 2018 12:11:57 +0300 Subject: [PATCH 3/4] Tests fixes --- emails/testsuite/conftest.py | 2 ++ emails/testsuite/loader/test_helpers.py | 2 ++ emails/testsuite/loader/test_loaders.py | 9 ++++----- emails/testsuite/smtp_servers.py | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) 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), } From 5356a865de2fa929d25a0a722e0497c0b21d735a Mon Sep 17 00:00:00 2001 From: Sergey Lavrinenko Date: Mon, 8 Oct 2018 15:48:02 +0300 Subject: [PATCH 4/4] ... --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0953c81..8c8e0c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ python: - "3.4" - "3.5" - "3.6" - - "3.7" script: py.test --cov emails