Skip to content

Commit

Permalink
Merge pull request #29 from plone/fix-tests
Browse files Browse the repository at this point in the history
Use formencode's xml_compare method to compare test results. This solves test failures on several systems.
  • Loading branch information
lrowe committed Jun 19, 2014
2 parents b5d3577 + 2b68953 commit 62ae47f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changelog
1.0.6 (unreleased)
------------------

* Use formencode's xml_compare method to compare test results. This solves test
failures on several systems.
[timo]

* Also evaluate if-not-content. However, we are at risk of replicating
apply-conditions.xsl in it's entirety. this needs refactoring.
[lentinj]
Expand Down
2 changes: 1 addition & 1 deletion lib/diazo/tests/esi/output.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:esi="http://www.edge-delivery.org/esi/1.0" xmlns="http://www.w3.org/1999/xhtml">
<html xmlns:esi="http://www.edge-delivery.org/esi/1.0">
<body>
<h1>theme</h1>
<esi:include src="extra.html?;filter_xpath=//*[@id%20=%20'something']"></esi:include>
Expand Down
2 changes: 1 addition & 1 deletion lib/diazo/tests/esi/theme.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<body>
<h1>theme</h1>
<div id="include">theme content</div>
Expand Down
6 changes: 3 additions & 3 deletions lib/diazo/tests/style-script-quoting-1/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
body > h1 { color: red; }
</style>
<script type="text/javascript">
var x = '<div>';
</script>
var x = 'foo';
</script>
<style type="text/css">
/* From the content */
div > p { color: blue; }
Expand All @@ -21,7 +21,7 @@ <h1>Title</h1>
<p>Some text</p>
</div>
<script type="text/javascript">
var y = '<span>';
var y = 'bar';
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions lib/diazo/tests/style-script-quoting-1/theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
body > h1 { color: red; }
</style>
<script type="text/javascript">
var x = '<div>';
var x = 'foo';
</script>
</head>
<body>
<h1>Title</h1>
<div id="content"></div>
<script type="text/javascript">
var y = '<span>';
var y = 'bar';
</script>
</body>
</html>
4 changes: 3 additions & 1 deletion lib/diazo/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import diazo.run

from diazo.utils import quote_param
from formencode.doctest_xml_compare import xml_compare


if __name__ == '__main__':
__file__ = sys.argv[0]
Expand Down Expand Up @@ -157,7 +159,7 @@ def testAll(self):
if os.path.exists(outputfn):
old = open(outputfn).read()
new = self.themed_string
if old != new:
if not xml_compare(etree.fromstring(old.strip()), etree.fromstring(new.strip())):
# if self.writefiles:
# open(outputfn + '.old', 'w').write(old)
for line in difflib.unified_diff(old.split('\n'),
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
'experimental.cssselect'],
extras_require={
'wsgi': ['repoze.xmliter>=0.3', 'WebOb'],
'test': ['repoze.xmliter>=0.3', 'WebOb', 'unittest2']},
'test': [
'formencode',
'repoze.xmliter>=0.3',
'WebOb',
'unittest2'
]},
entry_points="""
[console_scripts]
diazocompiler = diazo.compiler:main
Expand Down

0 comments on commit 62ae47f

Please sign in to comment.