Skip to content

Commit 8a49007

Browse files
committed
New script for comparing output from Django 0.96 vs 1.x
- Legacy-Id: 1682
1 parent 6a86f3d commit 8a49007

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

test/compare_096_1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python
2+
3+
import sys
4+
import os
5+
6+
# Warning: The following code assumes that this file is located in the svn
7+
# checkout directory, and hasn't been moved:
8+
ietfpath = os.path.abspath(__file__.rsplit("/", 1)[0] + "/..")
9+
sys.path.append(ietfpath)
10+
11+
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
12+
13+
from difflib import unified_diff
14+
import urllib2 as urllib
15+
from ietf.tests import get_testurls
16+
17+
django_server0 = os.environ.get("DJANGO_SERVER0", "http://127.0.0.1:8809")
18+
django_server1 = os.environ.get("DJANGO_SERVER1", "http://127.0.0.1:8810")
19+
django_server0.rstrip("/")
20+
django_server1.rstrip("/")
21+
22+
testtuples = get_testurls()
23+
24+
def fetch(url):
25+
file = urllib.urlopen(url)
26+
html = file.read()
27+
file.close()
28+
return html
29+
30+
for codes, url, master in testtuples:
31+
print "Testing "+url
32+
if not "200" in codes:
33+
print " Skipping, not 200 code"
34+
continue
35+
if url.startswith("/feed") or url.startswith("/sitemap"):
36+
print " Skipping Atom feeds and sitemaps"
37+
continue
38+
url0 = django_server0 + url
39+
url1 = django_server1 + url
40+
print " Fetching %s ..." % url0
41+
data0 = fetch(url0)
42+
print " Fetching %s ..." % url1
43+
data1 = fetch(url1)
44+
list0 = data0.split("\n")
45+
list1 = data1.split("\n")
46+
diff = "\n".join(unified_diff(list0, list1, url0, url1, "", "", 0, lineterm=""))
47+
if diff:
48+
print diff
49+
else:
50+
print " No difference found"

0 commit comments

Comments
 (0)