changeset 2644:40cf22f3f40b

Don't test wiki pages and don't write files if there are no changes.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Mon, 06 Aug 2007 03:56:59 +0200
parents ec855cfb2561
children 3f499601e702
files MoinMoin/_tests/test_sourcecode.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_sourcecode.py	Mon Aug 06 03:47:19 2007 +0200
+++ b/MoinMoin/_tests/test_sourcecode.py	Mon Aug 06 03:56:59 2007 +0200
@@ -23,6 +23,7 @@
     '/wiki/htdocs/applets/FCKeditor', # 3rd party GUI editor
     '/tests/wiki', # this is our test wiki
     '/wiki/htdocs', # this is our dist static stuff
+    '/wiki/data/pages', # wiki pages, there may be .py attachments
 ]
 
 TRAILING_SPACES = 'nochange' # 'nochange' or 'fix'
@@ -49,9 +50,15 @@
         f = file(path, 'rb')
         data = f.read()
         f.close()
-        data = FIX_TS_RE.sub('', data)
+        fixed = FIX_TS_RE.sub('', data)
+
+        # Don't write files if there's no need for that,
+        # as altering timestamps can be annoying with some tools.
+        if fixed == data:
+            return
+
         f = file(path, 'wb')
-        f.write(data)
+        f.write(fixed)
         f.close()
     # Please read and follow PEP8 - rerun this test until it does not fail any more,
     # any type of error is only reported ONCE (even if there are multiple).