Skip to content

Commit 240a26d

Browse files
committed
Fixed problem showing touch zones
- Version 10.7.2
1 parent ebdb6bd commit 240a26d

File tree

11 files changed

+44
-27
lines changed

11 files changed

+44
-27
lines changed

.idea/AndroidViewClient.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55
setup(name='androidviewclient',
6-
version='10.7.1',
6+
version='10.7.2',
77
description='''AndroidViewClient is a 100% pure python library and tools
88
that simplifies test script creation providing higher level
99
operations and the ability of obtaining the tree of Views present at

src/com/dtmilano/android/adb/adbclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@author: Diego Torres Milano
1818
'''
1919

20-
__version__ = '10.7.1'
20+
__version__ = '10.7.2'
2121

2222
import sys
2323
import warnings

src/com/dtmilano/android/concertina.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import time
2626

2727
__author__ = 'diego'
28-
__version__ = '10.7.1'
28+
__version__ = '10.7.2'
2929

3030
DEBUG = True
3131

src/com/dtmilano/android/controlpanel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@author: Ahmed Kasem
2020
'''
2121

22-
__version__ = '10.7.1'
22+
__version__ = '10.7.2'
2323

2424
import sys, os
2525
import Tkinter, tkFileDialog, ttk

src/com/dtmilano/android/culebron.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from com.dtmilano.android.common import profileEnd
2626
from com.dtmilano.android.concertina import Concertina
2727

28-
__version__ = '10.7.1'
28+
__version__ = '10.7.2'
2929

3030
import sys
3131
import threading
@@ -1153,7 +1153,7 @@ def unmarkTarget(self, _id):
11531153
def unmarkTargets(self):
11541154
if not self.areTargetsMarked:
11551155
return
1156-
for (_id, _) in self.markedTargetIds:
1156+
for _id in self.markedTargetIds:
11571157
self.unmarkTarget(_id)
11581158
self.markedTargetIds = {}
11591159
self.areTargetsMarked = False

src/com/dtmilano/android/uiautomator/uiautomatorhelper.py

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
DEBUG = True
1818

19+
lock = threading.Lock()
20+
1921
class RunTestsThread(threading.Thread):
2022
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None, adbClient=None, testClass=None, testRunner=None):
2123
threading.Thread.__init__(self, group=group, target=target, name=name, verbose=verbose)
@@ -24,11 +26,18 @@ def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, ver
2426
self.testRunner = testRunner
2527

2628
def run(self):
29+
lock.acquire()
30+
pkg = re.sub('\.test$', '', self.testClass)
31+
if DEBUG:
32+
print >> sys.stderr, "Cleaning up before start. Stopping '%s'" % pkg
33+
self.adbClient.shell('am force-stop ' + pkg)
34+
time.sleep(3)
2735
if DEBUG:
2836
print >> sys.stderr, "Starting test..."
37+
lock.release()
2938
out = self.adbClient.shell('am instrument -w ' + self.testClass + '/' + self.testRunner + '; echo "ERROR: $?"')
3039
if DEBUG:
31-
print >> sys.stderr, "Finished test."
40+
print >> sys.stderr, "\nFinished test."
3241
errmsg = out.splitlines()[-1]
3342
m = re.match('ERROR: (\d+)', errmsg)
3443
if m:
@@ -64,9 +73,11 @@ def __init__(self, adbclient, adb=None, localport=9999, remoteport=9999, hostnam
6473
self.__connectToServer(hostname, localport)
6574

6675
def __connectToServer(self, hostname, port):
76+
lock.acquire()
6777
self.conn = httplib.HTTPConnection(hostname, port)
6878
if not self.conn:
6979
raise RuntimeError("Cannot connect to %s:%d" % (hostname, port))
80+
lock.release()
7081

7182
def __whichAdb(self, adb):
7283
if adb:
@@ -91,31 +102,37 @@ def __runTests(self):
91102
# We need a new AdbClient instance with timeout=None (means, no timeout) for the long running test service
92103
newAdbClient = AdbClient(self.adbClient.serialno, self.adbClient.hostname, self.adbClient.port, timeout=None)
93104
self.thread = RunTestsThread(adbClient=newAdbClient, testClass=self.TEST_CLASS, testRunner=self.TEST_RUNNER)
105+
if DEBUG:
106+
print >> sys.stderr, "__runTests: starting thread"
94107
self.thread.start()
95108
if DEBUG:
96109
print >> sys.stderr, "__runTests: end"
97110

98111

99112
def __httpCommand(self, url, method='GET'):
100113
if self.isDarwin:
101-
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
102-
#!! The connection cannot be resued in OSX, it gives:
103-
#!! response = conn.getresponse()
104-
#!! File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1045, in getresponse
105-
#!! response.begin()
106-
#!! File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 409, in begin
107-
#!! version, status, reason = self._read_status()
108-
#!! File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 373, in _read_status
109-
#!! raise BadStatusLine(line)
110-
#!! httplib.BadStatusLine: ''
111-
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
114+
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
115+
# !! The connection cannot be resued in OSX, it gives:
116+
# !! response = conn.getresponse()
117+
# !! File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1045, in getresponse
118+
# !! response.begin()
119+
# !! File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 409, in begin
120+
# !! version, status, reason = self._read_status()
121+
# !! File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 373, in _read_status
122+
# !! raise BadStatusLine(line)
123+
# !! httplib.BadStatusLine: ''
124+
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
112125
self.__connectToServer(self.hostname, self.localPort)
113126
time.sleep(3)
114127
self.conn.request(method, url)
115-
response = self.conn.getresponse()
116-
if response.status == 200:
117-
return response.read()
118-
raise RuntimeError(response.status + " " + response.reason + " while " + method + " " + url)
128+
try:
129+
response = self.conn.getresponse()
130+
if response.status == 200:
131+
return response.read()
132+
raise RuntimeError(response.status + " " + response.reason + " while " + method + " " + url)
133+
except httplib.BadStatusLine, ex:
134+
print >> sys.stderr, 'ERROR:', ex
135+
return u''
119136

120137
#
121138
# UiAutomatorHelper internal commands

src/com/dtmilano/android/viewclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@author: Diego Torres Milano
1919
'''
2020

21-
__version__ = '10.7.1'
21+
__version__ = '10.7.2'
2222

2323
import sys
2424
import warnings

tools/culebra

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ___________________/ /__/ /__/ /__/ /________________________________
2020
2121
'''
2222

23-
__version__ = '10.7.1'
23+
__version__ = '10.7.2'
2424

2525
import re
2626
import sys

0 commit comments

Comments
 (0)