ソースを参照

deterministic ordering, to fix tests?

Oz N Tiram 9 年 前
コミット
b611d3f0a4
2 ファイル変更3 行追加3 行削除
  1. 2 2
      blogit/blogit.py
  2. 1 1
      tests/test_all.py

+ 2 - 2
blogit/blogit.py

@@ -338,8 +338,8 @@ def find_new_posts_and_pages(db):
 
     Q = Query()
     for root, dirs, files in os.walk(CONFIG['content_root']):
-        for filename in files:
-            if filename.endswith(('md', 'markdown')):
+        for filename in [f for f in files if f.endswith(('md', 'markdown'))]:
+            #if filename.endswith(('md', 'markdown')):
                 fullpath = os.path.join(root, filename)
                 _p = fullpath.split(CONFIG['content_root'])[-1].lstrip('/')
                 if not db.posts.contains(Q.filename == _p) and \

+ 1 - 1
tests/test_all.py

@@ -107,7 +107,7 @@ f.close()
 
 def write_file(i):
     f = open((os.path.join(CONFIG['content_root'],
-                           'post{}.md'.format(i))), 'w')
+                           'post{0:03d}.md'.format(i))), 'w')
     f.write(post.format(**{'number': i,
                            'tags':
                            ','.join(shift(tags, shift_factors[i-1])[:-1])}))