Skip to content

Commit

Permalink
Fixes test cases that uses python, while only python3 is available: F…
Browse files Browse the repository at this point in the history
…ixes #276 (#302)

* Updated tests cases that write python scripts, to use the python interpreter that the tests was run with

* fixed test cases
  • Loading branch information
JessicaTegner authored Oct 1, 2022
1 parent 3e7676d commit b2738b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def test_conversion_with_empty_filter(self):
def test_conversion_with_python_filter(self):
markdown_source = "**Here comes the content.**"
python_source = '''\
#!/usr/bin/env python
#!{0}
"""
Pandoc filter to convert all regular text to uppercase.
Expand All @@ -328,6 +328,8 @@ def caps(key, value, format, meta):
toJSONFilter(caps)
'''
python_source = textwrap.dedent(python_source)
python_source.format(sys.executable)

with closed_tempfile(".py", python_source) as tempfile:
output = pypandoc.convert_text(
markdown_source, to='html', format='md', outputfile=None, filters=tempfile
Expand Down Expand Up @@ -362,7 +364,7 @@ def test_conversion_with_mixed_filters(self):
lua = textwrap.dedent(lua)

python = """\
#!/usr/bin/env python
#!{0}
from pandocfilters import toJSONFilter, Para, Str
Expand All @@ -375,6 +377,7 @@ def func(key, value, format, meta):
"""
python = textwrap.dedent(python)
python.format(sys.executable)

with closed_tempfile(".lua", lua.format(1)) as temp1, closed_tempfile(".py", python.format(2)) as temp2:
with closed_tempfile(".lua", lua.format(3)) as temp3, closed_tempfile(".py", python.format(4)) as temp4:
Expand Down

0 comments on commit b2738b4

Please sign in to comment.