mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
Black 23 enforces some slightly more specific rules about empty line counts and redundant parenthesis removal, but the result is still compatible with Black 22. (This does not actually upgrade our Python environment to Black 23 yet.) Signed-off-by: Anders Kaseorg <anders@zulip.com>
20 lines
498 B
Python
20 lines
498 B
Python
import logging
|
|
import os
|
|
import subprocess
|
|
|
|
|
|
class DiffError(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 DiffError(msg)
|
|
|
|
command = ["node", mdiff_path, output, expected_output]
|
|
diff = subprocess.check_output(command, text=True)
|
|
return diff
|