diff options
author | Richard Darst <rkd@zgib.net> | 2009-08-16 02:18:54 (GMT) |
---|---|---|
committer | Richard Darst <rkd@zgib.net> | 2009-08-16 02:18:54 (GMT) |
commit | 4f2700b46897d48628ef11ce63df9e5b25d3ec41 (patch) | |
tree | 29ce82671ee2957dcbb1c52c6b4ed5aa691308a2 | |
parent | 5e55429ddff68c66e34a07424f375ec5da1dee17 (diff) |
Update test runner script to actually work
- Now doesn't ignore the status output of the supybot-based tests.
- Uses unittest framework (but not that well)
- Overall, works better now. But testing is still tricky, this is far
from perfect.
darcs-hash:20090816021854-82ea9-2dddc3860357fe20ea878d53c005e37171695361.gz
-rw-r--r-- | tests/run_test.py | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/tests/run_test.py b/tests/run_test.py index 053da1e..0d30f90 100644 --- a/tests/run_test.py +++ b/tests/run_test.py @@ -2,26 +2,48 @@ import os import sys +import unittest + +runing_tests = True + +class MeetBotTest(unittest.TestCase): + + def test_replay(self): + """Replay of a meeting, using __meeting__. + """ + sys.argv[1:] = ["replay", "test-script-1.log.txt"] + sys.path.insert(0, "..") + try: + execfile("../meeting.py", globals()) + finally: + del sys.path[0] + + def test_supybottests(self): + """Test by sending input to supybot, check responses. + + Uses the external supybot-test command. Unfortunantly, that + doesn't have a useful status code, so I need to parse the + output. + """ + os.symlink("..", "MeetBot") + try: + output = os.popen("supybot-test ./MeetBot 2>&1").read() + print output + assert 'FAILED' not in output, "supybot-based tests failed." + finally: + os.unlink("MeetBot") + + + +if __name__ == '__main__': + os.chdir(os.path.join(os.path.dirname(__file__), '.')) + unittest.main() -run_tests = True -os.chdir(os.path.join(os.path.dirname(__file__), '.')) -print sys.path -sys.path.insert(0, "..") -sys.argv[1:] = ["replay", "test-script-1.log.txt"] -execfile("../meeting.py") -del sys.path[0] -# Supybot-based tests -os.symlink("..", "MeetBot") -try: - sys.argv[1:] = ["./MeetBot"] - execfile("/usr/bin/supybot-test") -finally: - os.unlink("MeetBot") |