Commits

Lars Yencken committed a59961e

Add basic unit test module.

Comments (0)

Files changed (1)

test_drakeutil.py

+# -*- coding: utf-8 -*-
+#
+#  test_drakeutil.py
+#  drakeutil
+#
+
+"""
+Tests for drake helpers.
+"""
+
+import unittest
+from datetime_tz import datetime_tz as datetime
+import os
+
+import drakeutil
+
+
+class DrakeHelperTest(unittest.TestCase):
+    def test_file_mtime(self):
+        expected = datetime.utcfromtimestamp(
+                os.stat(__file__).st_mtime
+            )
+        self.assertEquals(drakeutil.file_timestamp(__file__), expected)
+
+    def test_file_mtime_missing(self):
+        self.assertEquals(drakeutil.file_timestamp(__file__ + '.unlikely'),
+                None)
+
+
+if __name__ == '__main__':
+    unittest.TextTestRunner(verbosity=1).run(
+            unittest.makeSuite(DrakeHelperTest)
+        )