mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	This lets us simplify the long-ish ‘../../static/js’ paths, and will remove the need for the ‘zrequire’ wrapper. Signed-off-by: Anders Kaseorg <anders@zulip.com>
		
			
				
	
	
		
			20 lines
		
	
	
		
			489 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			489 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import logging
 | 
						|
import os
 | 
						|
import subprocess
 | 
						|
 | 
						|
 | 
						|
class DiffError(Exception):
 | 
						|
    pass
 | 
						|
 | 
						|
 | 
						|
def diff_strings(output: str, expected_output: str) -> str:
 | 
						|
    mdiff_path = "web/tests/lib/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
 |