# HG changeset patch # User rosfran # Date 1179341180 -3600 # Node ID 4c7f6a9bfdede92081d8eb5337dfa9ff546bda7e # Parent 2af89a257a86a7149a230c18b446b74e5a0f818a [svn r681] Added configuration file parser (name/value pair list). diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_connection.py --- a/gmyth/tests/test_connection.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_connection.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,10 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_connection', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_connection', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_epg.py --- a/gmyth/tests/test_epg.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_epg.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,10 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_epg', ['myth://mythtv:mythtv@192.168.3.165:6543/?mythconverg'], 2) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_epg', ["myth://mythtv:mythtv@%s:%s/?mythconverg" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_file_download.py --- a/gmyth/tests/test_file_download.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_file_download.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,11 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_file_download', ['myth://192.168.3.165:6543/1000_20070330144500.nuv']) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_file_download', ["myth://%s:%s/1000_20070330144500.nuv" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) + diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_filelocal.py --- a/gmyth/tests/test_filelocal.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_filelocal.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,10 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_filelocal', ['myth://192.168.3.165:6543/1000_20070330144500.nuv']) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_filelocal', ["myth://%s:%s/1000_20070330144500.nuv" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_filetransfer.py --- a/gmyth/tests/test_filetransfer.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_filetransfer.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,11 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_filetransfer', ['myth://192.168.3.165:6543/1000_20070330144500.nuv']) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_filetransfer', ["myth://%s:%s/1000_20070330144500.nuv" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) + diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_livetv.py --- a/gmyth/tests/test_livetv.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_livetv.py Wed May 16 19:46:20 2007 +0100 @@ -3,16 +3,19 @@ #doc: stress tests over gmyth_livetv_* methods from testing_tools import start, finish +from utils import TestConfigFile import sys -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_livetv', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) finish(p) -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +p = start('gmyth_test_livetv', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) finish(p) -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +p = start('gmyth_test_livetv', ['myth://%s:%s/livetv?channel=1' % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_livetv_stress.py --- a/gmyth/tests/test_livetv_stress.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_livetv_stress.py Wed May 16 19:46:20 2007 +0100 @@ -3,16 +3,19 @@ #doc: stress tests over gmyth_livetv_* methods from testing_tools import start, finish +from utils import TestConfigFile import sys -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_livetv', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) finish(p) -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +p = start('gmyth_test_livetv', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) finish(p) -p = start('gmyth_test_livetv', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +p = start('gmyth_test_livetv', ['myth://%s:%s/livetv?channel=1' % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_main.py --- a/gmyth/tests/test_main.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_main.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,10 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('test', ['myth://192.168.3.165:6543/1000_20070330144500.nuv'], 2) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('test', ["myth://%s:%s/1000_20070330144500.nuv" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_monitor_handler.py --- a/gmyth/tests/test_monitor_handler.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_monitor_handler.py Wed May 16 19:46:20 2007 +0100 @@ -4,15 +4,18 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_monitor_handler', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_monitor_handler', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) finish(p) -p = start('gmyth_test_monitor_handler', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +p = start('gmyth_test_monitor_handler', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) finish(p) -p = start('gmyth_test_monitor_handler', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +p = start('gmyth_test_monitor_handler', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_program_info.py --- a/gmyth/tests/test_program_info.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_program_info.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,10 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_program_info', ['myth://192.168.3.165:6543/livetv?channel=1'], 2) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_program_info', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_recorder.py --- a/gmyth/tests/test_recorder.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_recorder.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,11 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_recorder', ['myth://mythtv:mythtv@192.168.3.165:6543/?mythconverg']) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_recorder', ["myth://%s:%s/livetv?channel=1" % (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) + diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/test_recordings.py --- a/gmyth/tests/test_recordings.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/test_recordings.py Wed May 16 19:46:20 2007 +0100 @@ -4,7 +4,11 @@ from testing_tools import start, finish import sys +from utils import TestConfigFile -p = start('gmyth_test_recordings', ['myth://mythtv:mythtv@192.168.3.165:6543/?mythconverg']) +cfg_file = TestConfigFile('test_scripts.cfg') + +p = start('gmyth_test_recordings', ["myth://mythtv:mythtv@%s:%s/?mythconverg" % \ + (cfg_file.get_host(), cfg_file.get_port())], 2) sys.exit(finish(p)) diff -r 2af89a257a86 -r 4c7f6a9bfded gmyth/tests/utils.py --- a/gmyth/tests/utils.py Wed May 16 18:48:13 2007 +0100 +++ b/gmyth/tests/utils.py Wed May 16 19:46:20 2007 +0100 @@ -1,6 +1,39 @@ import os import signal import time +import ConfigParser + +class TestConfigFile: + def __init__(self, filename = ""): + """Sets default values """ + if filename != "": + self.loadTestConfigFile(filename); + else: + self.host = '192.168.3.110' + self.port = 6543 + + def loadTestConfigFile(self, filename): + """Load the test script's config data from a file.""" + config = ConfigParser.ConfigParser() + if os.path.exists(filename): + config.read(filename) + try: + host = config.get("GMyth Test Scripts Config", "Host") + port = config.get("GMyth Test Scripts Config", "Port") + except: + raise "ConfigError", "Problems on configuration file (%s) " % filename + else: + self.host = host + self.port = port + else: + print "Creating file %s..." % filename + self.create() + + def get_host(self): + return self.host + + def get_port(self): + return self.port def wait_string(file, string): while True: