From 5a72bca56916f5d8f209ae9ba1e55a3c5cfeaab4 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Thu, 7 Feb 2013 23:04:43 +0000 Subject: Replace ndiff.py with stdlib's difflib --- src/zope/tal/runtest.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'src/zope/tal/runtest.py') diff --git a/src/zope/tal/runtest.py b/src/zope/tal/runtest.py index 4bc35c9..3677902 100644 --- a/src/zope/tal/runtest.py +++ b/src/zope/tal/runtest.py @@ -21,6 +21,7 @@ import glob import os import sys import traceback +import difflib from cStringIO import StringIO @@ -31,22 +32,7 @@ import zope.tal.driver import zope.tal.tests.utils def showdiff(a, b): - from . import ndiff # XXX consider using difflib - cruncher = ndiff.SequenceMatcher(ndiff.IS_LINE_JUNK, a, b) - for tag, alo, ahi, blo, bhi in cruncher.get_opcodes(): - if tag == "equal": - continue - print(nicerange(alo, ahi) + tag[0] + nicerange(blo, bhi)) - ndiff.dump('<', a, alo, ahi) - if a and b: - print('---') - ndiff.dump('>', b, blo, bhi) - -def nicerange(lo, hi): - if hi <= lo+1: - return str(lo+1) - else: - return "%d,%d" % (lo+1, hi) + print(''.join(difflib.ndiff(a, b))) def main(): opts = [] -- cgit v1.2.1