From b2738b45bcb9d31600135a7399528252d4c1b7d0 Mon Sep 17 00:00:00 2001 From: Jessica Tegner Date: Sat, 1 Oct 2022 06:23:10 +0200 Subject: [PATCH] Fixes test cases that uses python, while only python3 is available: Fixes #276 (#302) * Updated tests cases that write python scripts, to use the python interpreter that the tests was run with * fixed test cases --- tests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests.py b/tests.py index 026f323..982fe66 100755 --- a/tests.py +++ b/tests.py @@ -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. @@ -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 @@ -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 @@ -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: