Files
zulip/zerver/lib/mdiff.py
Anders Kaseorg f0ecb93515 zerver core: Remove unused imports.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-02 17:41:24 -08:00

19 lines
510 B
Python
Executable File

import os
import subprocess
import logging
class DiffException(Exception):
pass
def diff_strings(output: str, expected_output: str) -> str:
mdiff_path = "frontend_tests/zjsunit/mdiff.js"
if not os.path.isfile(mdiff_path): # nocoverage
msg = "Cannot find mdiff for markdown diff rendering"
logging.error(msg)
raise DiffException(msg)
command = ['node', mdiff_path, output, expected_output]
diff = subprocess.check_output(command).decode('utf-8')
return diff