Skip to content

Commit 7d1dddc

Browse files
committed
Merge pull request #1 from browserstack/travis
Travis configured
2 parents 3553104 + 134d9bd commit 7d1dddc

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
language: python
22

3+
python:
4+
- "2.7"
5+
- "3.2"
6+
- "3.3"
7+
- "3.4"
8+
- "3.5"
9+
310
before_install:
411
- true && `base64 --decode <<< ZXhwb3J0IEJST1dTRVJTVEFDS19BQ0NFU1NfS0VZPUh5VmZydXJvb3dYb041eGhLZEs2Cg==`
512

13+
script: python -m unittest discover

browserstack/local.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import subprocess, os, urllib2, time
1+
import subprocess, os, time
22
from browserstack.local_binary import LocalBinary
33
from browserstack.bserrors import BrowserStackLocalError
44

@@ -23,7 +23,7 @@ def _generate_cmd(self):
2323
return [self.binary_path] + cmd
2424

2525
def start(self, **kwargs):
26-
for key, value in kwargs.iteritems():
26+
for key, value in kwargs.items():
2727
self.__add_arg(key, value)
2828

2929
if 'binarypath' in self.options:

browserstack/local_binary.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
import platform, urllib2, os, sys, zipfile, stat, tempfile
1+
import platform, os, sys, zipfile, stat, tempfile
22
from browserstack.bserrors import BrowserStackLocalError
33

4+
try:
5+
from urllib.request import urlopen
6+
except ImportError:
7+
from urllib2 import urlopen
8+
49
class LocalBinary:
510
def __init__(self):
611
is_64bits = sys.maxsize > 2**32
712
osname = platform.system()
813
if osname == 'Darwin':
9-
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-darwin-x64"
14+
self.http_path = "https://s3.amazonaws.com/bs-automate-prod/local/BrowserStackLocal-darwin-x64"
1015
elif osname == 'Linux':
1116
if is_64bits:
12-
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-linux-x64"
17+
self.http_path = "https://s3.amazonaws.com/bs-automate-prod/local/BrowserStackLocal-linux-x64"
1318
else:
14-
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-linux-ia32"
19+
self.http_path = "https://s3.amazonaws.com/bs-automate-prod/local/BrowserStackLocal-linux-ia32"
1520
else:
16-
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal.exe"
21+
self.http_path = "https://s3.amazonaws.com/bs-automate-prod/local/BrowserStackLocal-win32.exe"
1722

1823
self.ordered_paths = [
1924
os.path.join(os.path.expanduser('~'), '.browserstack'),
@@ -41,8 +46,11 @@ def __available_dir(self):
4146
raise BrowserStackLocalError('Error trying to download BrowserStack Local binary')
4247

4348
def download(self, chunk_size=8192, progress_hook=None):
44-
response = urllib2.urlopen(self.http_path)
45-
total_size = int(response.info().getheader('Content-Length').strip())
49+
response = urlopen(self.http_path)
50+
try:
51+
total_size = int(response.info().getheader('Content-Length').strip())
52+
except:
53+
total_size = int(response.info().get_all('Content-Length')[0].strip())
4654
bytes_so_far = 0
4755

4856
dest_parent_dir = self.__available_dir()

tests/test_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import unittest, time, os, subprocess, urllib2
1+
import unittest, time, os, subprocess
22
from browserstack.local import Local, BrowserStackLocalError
33

44
class TestLocal(unittest.TestCase):

0 commit comments

Comments
 (0)