mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
We can replace ‘universal_newlines’ with ‘text’ when we bump our minimum Python version to 3.7. Signed-off-by: Anders Kaseorg <anders@zulip.com>
20 lines
520 B
Python
Executable File
20 lines
520 B
Python
Executable File
import logging
|
|
import os
|
|
import subprocess
|
|
|
|
|
|
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, universal_newlines=True)
|
|
return diff
|