# # # add_dir "tests" # # add_file "tests/automate.py" # content [4c72073f00f6314e9b269b035235de6cfc0cb444] # # set "tests/automate.py" # attr "mtn:execute" # value "true" # ============================================================ --- tests/automate.py 4c72073f00f6314e9b269b035235de6cfc0cb444 +++ tests/automate.py 4c72073f00f6314e9b269b035235de6cfc0cb444 @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import sys +sys.path.append("..") +import monotone +import config +import traceback + +def test_branches(mt): + """Test the mt.branches method""" + result = mt.branches() + if len(result) == 0: + raise Exception("No branches found") + +def test_tags(mt): + """Test the mt.tags method""" + result = mt.tags() + if len(result) == 0: + raise Exception("No tags found") + +def test_heads(mt): + """Test the mt.heads method""" + result = mt.heads(config.test_branch) + if len(result) == 0: + raise Exception("No heads found") + +def test_certs(mt): + """Test the mt.certs method""" + result = mt.certs(config.test_revision) + if len(result) == 0: + raise Exception("No certs") + +tests = [ + test_branches, + test_tags, + test_heads, + test_certs, +] + +def test(): + for idx, test in enumerate(tests): + def log(s): + print "#%-3d %s" % (idx, s) + log(test.__doc__) + try: test(mt) + except: + log ("Test FAILED; traceback follows") + traceback.print_exc() + +if __name__ == "__main__": + mt = monotone.Monotone(config.monotone, config.dbfile) + while 1: + test() + print "** Test run complete." + +