ソースを参照

Expand documentation on testing

oz123 10 年 前
コミット
c6202d89e6
1 ファイル変更31 行追加0 行削除
  1. 31 0
      documentation/general_notes.txt

+ 31 - 0
documentation/general_notes.txt

@@ -95,3 +95,34 @@ fi
 make test || exit 1
 exit 0
 
+### testing :
+
+Each class should have at least 95% coverage. 
+Each module should be tested as a stand alone with:
+
+  foo.py 
+  test_foo.py 
+
+The test module test_foo.py should contain at the bottom:
+
+    if __name__ == '__main__':
+        
+        # prepare everything for testing 
+        try:
+            unittest.main(verbosity=2)
+        except SystemExit:
+            # clean everything after test was run 
+
+You should be able to run the module testing with:
+
+    $ python -m pwman.tests.test_foo
+
+But you should also run the tests as part of a larger scheme with:
+
+
+    from test_foo import TestFoo 
+    ...
+    ...
+    loader = unittest.TestLoader()
+    suite = unittest.TestSuite()
+    suite.addTest(loader.loadTestsFromTestCase(DBTests))