[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31153] branches/soc-2010-leifandersen/ tests/python/hash_compare.py: 1.

Leif Andersen leif.a.andersen at gmail.com
Sun Aug 8 04:24:46 CEST 2010


Revision: 31153
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31153
Author:   leifandersen
Date:     2010-08-08 04:24:46 +0200 (Sun, 08 Aug 2010)

Log Message:
-----------
1.  Woops (again), added the 'outer shell' file for python. ;)

Added Paths:
-----------
    branches/soc-2010-leifandersen/tests/python/hash_compare.py

Added: branches/soc-2010-leifandersen/tests/python/hash_compare.py
===================================================================
--- branches/soc-2010-leifandersen/tests/python/hash_compare.py	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/python/hash_compare.py	2010-08-08 02:24:46 UTC (rev 31153)
@@ -0,0 +1,48 @@
+import bpy
+import tests
+import mathutils
+
+import unittest
+import sys
+import os
+
+from mathutils import *
+
+data = []
+
+class TestCurrentFile(unittest.TestCase):
+    
+    name = ''
+    hash_start = 0
+    hash_end = 0
+    
+    def setUp(self):
+        self.name = os.path.split(bpy.data.filepath)[1]
+        self.hash_start = data[self.name + '_start']
+        self.hash_end = data[self.name + '_end']
+    
+    def test_case(self):
+        bpy.ops.tests.hash()
+        #tests.hashfile.data[os.path.split(bpy.data.filepath)[1]+'_start'] = tests.hashfile.last_hash
+        #bpy.ops.tests.write_hashfile(filepath=os.path.join(os.path.split(sys.argv[0])[0], 'hashfile.txt'))
+        self.assertEquals(self.hash_start, tests.hashfile.last_hash)
+
+        mod = __import__(self.name.replace('.py.blend', ''))
+        mod.func()
+        
+        bpy.ops.tests.hash()
+        #tests.hashfile.data[os.path.split(bpy.data.filepath)[1]+'_end'] = tests.hashfile.last_hash
+        #bpy.ops.tests.write_hashfile(filepath=os.path.join(os.path.split(sys.argv[0])[0], 'hashfile.txt'))
+        self.assertEquals(self.hash_end, tests.hashfile.last_hash)
+
+def suite():
+    return unittest.TestSuite([
+unittest.TestLoader().loadTestsFromTestCase(TestCurrentFile),
+])
+
+if __name__ == "__main__":
+    sys.path.append(os.path.split(sys.argv[1])[0])
+    bpy.ops.tests.read_hashfile(filepath=os.path.join(os.path.split(sys.argv[0])[0], 'hashfile.txt'))
+    data = tests.hashfile.data
+    unittest.TextTestRunner(verbosity=2).run(suite())
+    bpy.ops.wm.exit_blender()





More information about the Bf-blender-cvs mailing list