From 8ba14779884b2d1913de1ae4abf6fdeea130838a Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 24 Aug 2017 22:31:35 -0400 Subject: [tests] workaround some errors while running tests --- tests/functional/features/environment.py | 11 ++++++++--- tests/functional/features/steps/vpn.py | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'tests/functional') diff --git a/tests/functional/features/environment.py b/tests/functional/features/environment.py index 5b179cd5..c92a39d0 100644 --- a/tests/functional/features/environment.py +++ b/tests/functional/features/environment.py @@ -1,12 +1,14 @@ +import commands import os +import sys import shutil import re -import time + from urlparse import urlparse -import commands from selenium import webdriver from selenium.webdriver.chrome.options import Options + from leap.common.config import get_path_prefix DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S = 10 @@ -102,7 +104,10 @@ def _save_screenshot(context, step): def _save_config(context, step): filepath = _artifact_path(step, 'config') - shutil.copytree(get_path_prefix(), filepath) + try: + shutil.copytree(get_path_prefix(), filepath) + except OSError: + pass print('copied config to: file://%s' % filepath) diff --git a/tests/functional/features/steps/vpn.py b/tests/functional/features/steps/vpn.py index 05ed2b54..43673597 100644 --- a/tests/functional/features/steps/vpn.py +++ b/tests/functional/features/steps/vpn.py @@ -15,12 +15,16 @@ def record_ip(context): def _current_ip(): - url = 'https://wtfismyip.com/json' + url = 'https://ipapi.co/json' r = requests.get(url) - data = r.json() + try: + data = r.json() + except Exception: + print("ERROR: data received was %s" % r.content) + raise - current_ip = data['YourFuckingIPAddress'] + current_ip = data.get('ip') print("Current IP: %s\n\n" % current_ip) return current_ip -- cgit v1.2.3