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

remove dependency on "FakeFSHelpers", accept newer version of css_inline #59

Merged
merged 3 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -46,7 +46,7 @@ install_requires =
jinja2

scripts =
mjml/scripts/mjml-html-compare
mjml/scripts/mjml-html-compare


[options.packages.find]
Expand All @@ -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
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=...)
# >= 0.11: CSSInliner(inline_style_tags=..., keep_link_tags=..., keep_style_tags=...)
css_inline >= 0.11


[options.entry_points]
Expand Down
28 changes: 17 additions & 11 deletions tests/includes_with_umlauts_test.py
Original file line number Diff line number Diff line change
@@ -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 = (
'<mj-section>'
' <mj-column>'
Expand All @@ -30,9 +34,11 @@ def test_can_properly_handle_include_umlauts(fs):
' </mj-body>'
'</mjml>'
)
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)
Loading