Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/run_test.py
blob: 0a1094ab82606ce1e18b83de2d697ae7fc99f514 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Richard Darst, 2009

import os
import sys
import unittest

running_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__':
    if len(sys.argv) <= 1:
        os.chdir(os.path.join(os.path.dirname(__file__), '.'))
        unittest.main()
    else:
        for testname in sys.argv[1:]:
            print testname
            MeetBotTest(methodName='test_'+testname).debug()