From 0e2502d8d40dc11d93e6ef5a10837f8243edb186 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Wed, 14 Aug 2024 09:30:31 +0200 Subject: [PATCH 1/3] `setup.cfg`: replace tabs with spaces --- setup.cfg | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/setup.cfg b/setup.cfg index e3cca47..c658e69 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,22 +14,22 @@ license = MIT license_files = LICENSE.txt classifiers = - Development Status :: 4 - Beta - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Topic :: Communications :: Email - Topic :: Text Processing :: Markup :: HTML + Development Status :: 4 - Beta + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + Topic :: Communications :: Email + Topic :: Text Processing :: Markup :: HTML project_urls = - Code = https://github.com/FelixSchwarz/mjml-python - Issue tracker = https://github.com/FelixSchwarz/mjml-python/issues + Code = https://github.com/FelixSchwarz/mjml-python + Issue tracker = https://github.com/FelixSchwarz/mjml-python/issues [options] @@ -46,7 +46,7 @@ install_requires = jinja2 scripts = - mjml/scripts/mjml-html-compare + mjml/scripts/mjml-html-compare [options.packages.find] @@ -55,12 +55,12 @@ exclude = [options.extras_require] testing = - FakeFSHelpers - HTMLCompare >= 0.3.0 # >= 0.3.0: ability to ignore attribute ordering in HTML - lxml - pytest + FakeFSHelpers + HTMLCompare >= 0.3.0 # >= 0.3.0: ability to ignore attribute ordering in HTML + lxml + pytest css_inlining = - css_inline >= 0.11, < 0.14 # >= 0.11, < 0.14: CSSInliner(inline_style_tags=..., keep_link_tags=..., keep_style_tags=...) + css_inline >= 0.11, < 0.14 # >= 0.11, < 0.14: CSSInliner(inline_style_tags=..., keep_link_tags=..., keep_style_tags=...) [options.entry_points] From e58999242a56ce077784445bdf29136f96b9f5eb Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Wed, 14 Aug 2024 09:37:51 +0200 Subject: [PATCH 2/3] remove dependency on "FakeFSHelpers" --- setup.cfg | 1 - tests/includes_with_umlauts_test.py | 28 +++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/setup.cfg b/setup.cfg index c658e69..b3070ca 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,7 +55,6 @@ exclude = [options.extras_require] testing = - FakeFSHelpers HTMLCompare >= 0.3.0 # >= 0.3.0: ability to ignore attribute ordering in HTML lxml pytest diff --git a/tests/includes_with_umlauts_test.py b/tests/includes_with_umlauts_test.py index e97bd29..4edc97d 100644 --- a/tests/includes_with_umlauts_test.py +++ b/tests/includes_with_umlauts_test.py @@ -1,20 +1,24 @@ +import os +from contextlib import contextmanager from io import StringIO -import pytest -from schwarz.fakefs_helpers import FakeFS - from mjml import mjml_to_html -@pytest.fixture -def fs(): - _fs = FakeFS.set_up() - yield _fs - _fs.tear_down() +# could use "contextlib.chdir" in Python 3.11+ +# https://github.com/python/cpython/commit/3592980f9122ab0d9ed93711347742d110b749c2 +@contextmanager +def chdir(path): + old_chdir = os.getcwd() + try: + os.chdir(path) + yield + finally: + os.chdir(old_chdir) -def test_can_properly_handle_include_umlauts(fs): +def test_can_properly_handle_include_umlauts(tmp_path): included_mjml = ( '' ' ' @@ -30,9 +34,11 @@ def test_can_properly_handle_include_umlauts(fs): ' ' '' ) - fs.create_file('footer.mjml', contents=included_mjml.encode('utf8')) + path_footer = tmp_path / 'footer.mjml' + path_footer.write_text(included_mjml, encoding='utf8') - result = mjml_to_html(StringIO(mjml)) + with chdir(tmp_path): + result = mjml_to_html(StringIO(mjml)) html = result.html assert ('äöüß' in html) From db30be0e35c0f1b0cd813190c991eeccd9f52e11 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Wed, 14 Aug 2024 09:39:07 +0200 Subject: [PATCH 3/3] accept also `css_inline >= 0.14` (#55) --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index b3070ca..8b0a3bc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -59,7 +59,8 @@ testing = lxml pytest css_inlining = - css_inline >= 0.11, < 0.14 # >= 0.11, < 0.14: CSSInliner(inline_style_tags=..., keep_link_tags=..., keep_style_tags=...) + # >= 0.11: CSSInliner(inline_style_tags=..., keep_link_tags=..., keep_style_tags=...) + css_inline >= 0.11 [options.entry_points]