* Adding 3 generic chunks, which will ignore the A-hat diffs and the

'produced by' diffs.
 * Updating ietf/tests.py to handle diff chunks right
 - Legacy-Id: 316
This commit is contained in:
Henrik Levkowetz 2007-06-11 18:44:49 +00:00
parent 8e8c3ff5e2
commit e7a13bff68
4 changed files with 46 additions and 16 deletions

View file

@ -97,7 +97,13 @@ class UrlTestCase(TestCase):
for item in os.listdir(testdir):
path = testdir + "/" + item
if item.startswith("generic-") and os.path.isfile(path):
self.diffchunks.append(filetext(path))
chunk = filetext(path)
chunk = re.sub(r"([\[\]().|+*?])", r"\\\1", chunk)
# @@ -27,0 \+23,1 @@
chunk = re.sub(r"(?m)^@@ -\d+,(\d+) \\\+\d+,(\d+) @@$", r"@@ -\d+,\1 \+\d+,\2 @@", chunk)
#print "*** Installing diff chunk:"
#print chunk
self.diffchunks.append(chunk)
# extract application urls:
self.patterns = get_patterns(ietf.urls)
@ -165,8 +171,15 @@ class UrlTestCase(TestCase):
contextlines = 0
diff = "\n".join(unified_diff(goodtext, testtext, master, url, "", "", contextlines, lineterm=""))
for chunk in self.diffchunks:
if chunk in diff:
diff = diff.replace(chunk, "")
#print "*** Checking for chunk:", chunk[:24]
while re.search(chunk, diff):
#print "*** Removing chunk of %s lines" % (len(chunk.split("\n")))
diff = re.sub(chunk, "", diff)
if len(diff.strip().split()) == 2:
# only the initial 2 lines of the diff remains --
# discard them too
diff = ""
if diff:
dfile = "%s/../test/diff/%s" % (settings.BASE_DIR, url.replace("/", "_"))
if os.path.exists(dfile):
dfile = open(dfile)

View file

@ -0,0 +1,3 @@
@@ -16,1 +16,1 @@
-request makes it into the ID tracker.)  A document in this state has
+request makes it into the ID tracker.) A document in this state has

View file

@ -0,0 +1,6 @@
@@ -12,0 +12,5 @@
+Did you find a bug? Let us know .
+
+Any question or suggestion ?
+
+This page produced by the IETF Secretariat for the IESG

View file

@ -0,0 +1,8 @@
@@ -27,0 +23,1 @@
+Did you find a bug? Let us know .
@@ -28,0 +25,5 @@
+Any question or suggestion ?
+
+This page produced by the IETF Secretariat for the IESG
+
+