Skip to content

Commit

Permalink
remove dependency on "FakeFSHelpers"
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixSchwarz committed Aug 18, 2024
1 parent 8b971a9 commit 997dbf9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
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)

0 comments on commit 997dbf9

Please # to comment.