[svn r681] Added configuration file parser (name/value pair list).
1.1 --- a/gmyth/tests/test_connection.py Wed May 16 18:48:13 2007 +0100
1.2 +++ b/gmyth/tests/test_connection.py Wed May 16 19:46:20 2007 +0100
1.3 @@ -4,7 +4,10 @@
1.4
1.5 from testing_tools import start, finish
1.6 import sys
1.7 +from utils import TestConfigFile
1.8
1.9 -p = start('gmyth_test_connection', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
1.10 +cfg_file = TestConfigFile('test_scripts.cfg')
1.11 +
1.12 +p = start('gmyth_test_connection', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
1.13
1.14 sys.exit(finish(p))
2.1 --- a/gmyth/tests/test_epg.py Wed May 16 18:48:13 2007 +0100
2.2 +++ b/gmyth/tests/test_epg.py Wed May 16 19:46:20 2007 +0100
2.3 @@ -4,7 +4,10 @@
2.4
2.5 from testing_tools import start, finish
2.6 import sys
2.7 +from utils import TestConfigFile
2.8
2.9 -p = start('gmyth_test_epg', ['myth://mythtv:mythtv@192.168.3.165:6543/?mythconverg'], 2)
2.10 +cfg_file = TestConfigFile('test_scripts.cfg')
2.11 +
2.12 +p = start('gmyth_test_epg', ["myth://mythtv:mythtv@%s:%s/?mythconverg" % (cfg_file.get_host(), cfg_file.get_port())], 2)
2.13
2.14 sys.exit(finish(p))
3.1 --- a/gmyth/tests/test_file_download.py Wed May 16 18:48:13 2007 +0100
3.2 +++ b/gmyth/tests/test_file_download.py Wed May 16 19:46:20 2007 +0100
3.3 @@ -4,7 +4,11 @@
3.4
3.5 from testing_tools import start, finish
3.6 import sys
3.7 +from utils import TestConfigFile
3.8
3.9 -p = start('gmyth_test_file_download', ['myth://192.168.3.165:6543/1000_20070330144500.nuv'])
3.10 +cfg_file = TestConfigFile('test_scripts.cfg')
3.11 +
3.12 +p = start('gmyth_test_file_download', ["myth://%s:%s/1000_20070330144500.nuv" % (cfg_file.get_host(), cfg_file.get_port())], 2)
3.13
3.14 sys.exit(finish(p))
3.15 +
4.1 --- a/gmyth/tests/test_filelocal.py Wed May 16 18:48:13 2007 +0100
4.2 +++ b/gmyth/tests/test_filelocal.py Wed May 16 19:46:20 2007 +0100
4.3 @@ -4,7 +4,10 @@
4.4
4.5 from testing_tools import start, finish
4.6 import sys
4.7 +from utils import TestConfigFile
4.8
4.9 -p = start('gmyth_test_filelocal', ['myth://192.168.3.165:6543/1000_20070330144500.nuv'])
4.10 +cfg_file = TestConfigFile('test_scripts.cfg')
4.11 +
4.12 +p = start('gmyth_test_filelocal', ["myth://%s:%s/1000_20070330144500.nuv" % (cfg_file.get_host(), cfg_file.get_port())], 2)
4.13
4.14 sys.exit(finish(p))
5.1 --- a/gmyth/tests/test_filetransfer.py Wed May 16 18:48:13 2007 +0100
5.2 +++ b/gmyth/tests/test_filetransfer.py Wed May 16 19:46:20 2007 +0100
5.3 @@ -4,7 +4,11 @@
5.4
5.5 from testing_tools import start, finish
5.6 import sys
5.7 +from utils import TestConfigFile
5.8
5.9 -p = start('gmyth_test_filetransfer', ['myth://192.168.3.165:6543/1000_20070330144500.nuv'])
5.10 +cfg_file = TestConfigFile('test_scripts.cfg')
5.11 +
5.12 +p = start('gmyth_test_filetransfer', ["myth://%s:%s/1000_20070330144500.nuv" % (cfg_file.get_host(), cfg_file.get_port())], 2)
5.13
5.14 sys.exit(finish(p))
5.15 +
6.1 --- a/gmyth/tests/test_livetv.py Wed May 16 18:48:13 2007 +0100
6.2 +++ b/gmyth/tests/test_livetv.py Wed May 16 19:46:20 2007 +0100
6.3 @@ -3,16 +3,19 @@
6.4 #doc: stress tests over gmyth_livetv_* methods
6.5
6.6 from testing_tools import start, finish
6.7 +from utils import TestConfigFile
6.8 import sys
6.9
6.10 -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
6.11 +cfg_file = TestConfigFile('test_scripts.cfg')
6.12 +
6.13 +p = start('gmyth_test_livetv', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
6.14
6.15 finish(p)
6.16
6.17 -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
6.18 +p = start('gmyth_test_livetv', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
6.19
6.20 finish(p)
6.21
6.22 -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
6.23 +p = start('gmyth_test_livetv', ['myth://%s:%s/livetv?channel=1' % (cfg_file.get_host(), cfg_file.get_port())], 2)
6.24
6.25 sys.exit(finish(p))
7.1 --- a/gmyth/tests/test_livetv_stress.py Wed May 16 18:48:13 2007 +0100
7.2 +++ b/gmyth/tests/test_livetv_stress.py Wed May 16 19:46:20 2007 +0100
7.3 @@ -3,16 +3,19 @@
7.4 #doc: stress tests over gmyth_livetv_* methods
7.5
7.6 from testing_tools import start, finish
7.7 +from utils import TestConfigFile
7.8 import sys
7.9
7.10 -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
7.11 +cfg_file = TestConfigFile('test_scripts.cfg')
7.12 +
7.13 +p = start('gmyth_test_livetv', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
7.14
7.15 finish(p)
7.16
7.17 -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
7.18 +p = start('gmyth_test_livetv', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
7.19
7.20 finish(p)
7.21
7.22 -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
7.23 +p = start('gmyth_test_livetv', ['myth://%s:%s/livetv?channel=1' % (cfg_file.get_host(), cfg_file.get_port())], 2)
7.24
7.25 sys.exit(finish(p))
8.1 --- a/gmyth/tests/test_main.py Wed May 16 18:48:13 2007 +0100
8.2 +++ b/gmyth/tests/test_main.py Wed May 16 19:46:20 2007 +0100
8.3 @@ -4,7 +4,10 @@
8.4
8.5 from testing_tools import start, finish
8.6 import sys
8.7 +from utils import TestConfigFile
8.8
8.9 -p = start('test', ['myth://192.168.3.165:6543/1000_20070330144500.nuv'], 2)
8.10 +cfg_file = TestConfigFile('test_scripts.cfg')
8.11 +
8.12 +p = start('test', ["myth://%s:%s/1000_20070330144500.nuv" % (cfg_file.get_host(), cfg_file.get_port())], 2)
8.13
8.14 sys.exit(finish(p))
9.1 --- a/gmyth/tests/test_monitor_handler.py Wed May 16 18:48:13 2007 +0100
9.2 +++ b/gmyth/tests/test_monitor_handler.py Wed May 16 19:46:20 2007 +0100
9.3 @@ -4,15 +4,18 @@
9.4
9.5 from testing_tools import start, finish
9.6 import sys
9.7 +from utils import TestConfigFile
9.8
9.9 -p = start('gmyth_test_monitor_handler', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
9.10 +cfg_file = TestConfigFile('test_scripts.cfg')
9.11 +
9.12 +p = start('gmyth_test_monitor_handler', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
9.13
9.14 finish(p)
9.15
9.16 -p = start('gmyth_test_monitor_handler', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
9.17 +p = start('gmyth_test_monitor_handler', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
9.18
9.19 finish(p)
9.20
9.21 -p = start('gmyth_test_monitor_handler', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
9.22 +p = start('gmyth_test_monitor_handler', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
9.23
9.24 sys.exit(finish(p))
10.1 --- a/gmyth/tests/test_program_info.py Wed May 16 18:48:13 2007 +0100
10.2 +++ b/gmyth/tests/test_program_info.py Wed May 16 19:46:20 2007 +0100
10.3 @@ -4,7 +4,10 @@
10.4
10.5 from testing_tools import start, finish
10.6 import sys
10.7 +from utils import TestConfigFile
10.8
10.9 -p = start('gmyth_test_program_info', ['myth://192.168.3.165:6543/livetv?channel=1'], 2)
10.10 +cfg_file = TestConfigFile('test_scripts.cfg')
10.11 +
10.12 +p = start('gmyth_test_program_info', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
10.13
10.14 sys.exit(finish(p))
11.1 --- a/gmyth/tests/test_recorder.py Wed May 16 18:48:13 2007 +0100
11.2 +++ b/gmyth/tests/test_recorder.py Wed May 16 19:46:20 2007 +0100
11.3 @@ -4,7 +4,11 @@
11.4
11.5 from testing_tools import start, finish
11.6 import sys
11.7 +from utils import TestConfigFile
11.8
11.9 -p = start('gmyth_test_recorder', ['myth://mythtv:mythtv@192.168.3.165:6543/?mythconverg'])
11.10 +cfg_file = TestConfigFile('test_scripts.cfg')
11.11 +
11.12 +p = start('gmyth_test_recorder', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2)
11.13
11.14 sys.exit(finish(p))
11.15 +
12.1 --- a/gmyth/tests/test_recordings.py Wed May 16 18:48:13 2007 +0100
12.2 +++ b/gmyth/tests/test_recordings.py Wed May 16 19:46:20 2007 +0100
12.3 @@ -4,7 +4,11 @@
12.4
12.5 from testing_tools import start, finish
12.6 import sys
12.7 +from utils import TestConfigFile
12.8
12.9 -p = start('gmyth_test_recordings', ['myth://mythtv:mythtv@192.168.3.165:6543/?mythconverg'])
12.10 +cfg_file = TestConfigFile('test_scripts.cfg')
12.11 +
12.12 +p = start('gmyth_test_recordings', ["myth://mythtv:mythtv@%s:%s/?mythconverg" % \
12.13 + (cfg_file.get_host(), cfg_file.get_port())], 2)
12.14
12.15 sys.exit(finish(p))
13.1 --- a/gmyth/tests/utils.py Wed May 16 18:48:13 2007 +0100
13.2 +++ b/gmyth/tests/utils.py Wed May 16 19:46:20 2007 +0100
13.3 @@ -1,6 +1,39 @@
13.4 import os
13.5 import signal
13.6 import time
13.7 +import ConfigParser
13.8 +
13.9 +class TestConfigFile:
13.10 + def __init__(self, filename = ""):
13.11 + """Sets default values """
13.12 + if filename != "":
13.13 + self.loadTestConfigFile(filename);
13.14 + else:
13.15 + self.host = '192.168.3.110'
13.16 + self.port = 6543
13.17 +
13.18 + def loadTestConfigFile(self, filename):
13.19 + """Load the test script's config data from a file."""
13.20 + config = ConfigParser.ConfigParser()
13.21 + if os.path.exists(filename):
13.22 + config.read(filename)
13.23 + try:
13.24 + host = config.get("GMyth Test Scripts Config", "Host")
13.25 + port = config.get("GMyth Test Scripts Config", "Port")
13.26 + except:
13.27 + raise "ConfigError", "Problems on configuration file (%s) " % filename
13.28 + else:
13.29 + self.host = host
13.30 + self.port = port
13.31 + else:
13.32 + print "Creating file %s..." % filename
13.33 + self.create()
13.34 +
13.35 + def get_host(self):
13.36 + return self.host
13.37 +
13.38 + def get_port(self):
13.39 + return self.port
13.40
13.41 def wait_string(file, string):
13.42 while True: