From 4c3dcda7e8c794f24b6905c534c8e0445d0d7928 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 16 Aug 2013 15:25:31 -0400 Subject: [PATCH] Hack to get around many types of string encodings Changed the port listing Changing to better readability --- lms/envs/sauce.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lms/envs/sauce.py b/lms/envs/sauce.py index 2692037082..1704edd68b 100644 --- a/lms/envs/sauce.py +++ b/lms/envs/sauce.py @@ -9,12 +9,11 @@ so that we can run the lettuce acceptance tests on SauceLabs. from selenium.webdriver.common.desired_capabilities import DesiredCapabilities import os -import json PORTS = [2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, - 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, - 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, - 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, + 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, + 5050, 5555, 5432, 6060, 6666, 6543, 7000, 7070, 7774, + 7777, 8003, 8031, 8080, 8081, 8765, 8888, 9080, 9090, 9876, 9999, 49221, 55001] DESIRED_CAPABILITIES = { @@ -28,19 +27,25 @@ DESIRED_CAPABILITIES = { 'android': DesiredCapabilities.ANDROID } -DEFAULT_CONFIG='{"PLATFORM":"Linux", "BROWSER":"chrome", "VERISON":"", "DEVICE":""}' -SAUCE_INFO = json.loads(os.environ.get('SAUCE_INFO', DEFAULT_CONFIG)) +#HACK +#This needs to be done because Jenkins needs to satisfy URLs, JSON, BASH, SAUCE, and PYTHON +#This is the simplest way to adhere to all of these requirements and still be readible +DEFAULT_CONFIG = 'Linux-chrome--' + +SAUCE_INFO = os.environ.get('SAUCE_INFO', DEFAULT_CONFIG).split('-') +if len(SAUCE_INFO) !=4: + SAUCE_INFO = DEFAULT_CONFIG.split('-') # Information needed to utilize Sauce Labs. SAUCE = { 'SAUCE_ENABLED': os.environ.get('SAUCE_ENABLED'), 'USERNAME': os.environ.get('SAUCE_USER_NAME'), 'ACCESS_ID': os.environ.get('SAUCE_API_KEY'), - 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO.get('BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME), - 'PLATFORM': SAUCE_INFO.get('PLATFORM', 'Linux'), - 'VERSION': SAUCE_INFO.get('VERSION', ''), - 'DEVICE': SAUCE_INFO.get('DEVICE', ''), + 'BROWSER': DESIRED_CAPABILITIES.get(SAUCE_INFO[0].lower(), DesiredCapabilities.CHROME), + 'PLATFORM': SAUCE_INFO[0], + 'VERSION': SAUCE_INFO[2], + 'DEVICE': SAUCE_INFO[3], 'SESSION': 'Jenkins Acceptance Tests', 'BUILD': os.environ.get('JOB_NAME', 'LETTUCE TESTS'), }