Bug 904292 - Clean up marionette pyflakes warnings;r=mdas

This commit is contained in:
William Lachance 2013-08-13 10:24:33 -07:00
parent 509aaed52a
commit 0bfb82e196
6 changed files with 10 additions and 22 deletions

View File

@ -7,19 +7,16 @@ import imp
import os import os
import re import re
import subprocess import subprocess
import sys
import tempfile
import time import time
import types import types
import unittest
import weakref import weakref
from b2ginstance import B2GInstance from b2ginstance import B2GInstance
from client import MarionetteClient from client import MarionetteClient
from errors import MarionetteException, InvalidResponseException from errors import InvalidResponseException
from marionette import Marionette from marionette import Marionette
from marionette_test import MarionetteTestCase from marionette_test import MarionetteTestCase
from runtests import MarionetteTestRunner, cli, parse_options, startTestRunner from runtests import MarionetteTestRunner, cli
class B2GUpdateMarionetteClient(MarionetteClient): class B2GUpdateMarionetteClient(MarionetteClient):
RETRY_TIMEOUT = 5 RETRY_TIMEOUT = 5
@ -361,7 +358,6 @@ class B2GUpdateTestCase(MarionetteTestCase):
self.fail('Timed out waiting for B2G process to start during FOTA update') self.fail('Timed out waiting for B2G process to start during FOTA update')
def flash(self, flash_script): def flash(self, flash_script):
update_tools = self.runner.update_tools
flash_build = os.path.basename(os.path.dirname(flash_script)) flash_build = os.path.basename(os.path.dirname(flash_script))
self.print_status('FLASH-BUILD', flash_build) self.print_status('FLASH-BUILD', flash_build)

View File

@ -13,7 +13,6 @@ import platform
import shutil import shutil
import socket import socket
import subprocess import subprocess
import sys
from telnetlib import Telnet from telnetlib import Telnet
import tempfile import tempfile
import time import time
@ -462,16 +461,14 @@ waitFor(
""" Set up TCP port forwarding to the specified port on the device, """ Set up TCP port forwarding to the specified port on the device,
using any availble local port, and return the local port. using any availble local port, and return the local port.
""" """
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("",0)) s.bind(("",0))
local_port = s.getsockname()[1] local_port = s.getsockname()[1]
s.close() s.close()
output = self._run_adb(['forward', self._run_adb(['forward',
'tcp:%d' % local_port, 'tcp:%d' % local_port,
'tcp:%d' % remote_port]) 'tcp:%d' % remote_port])
self.marionette_port = local_port self.marionette_port = local_port

View File

@ -149,15 +149,15 @@ class Actions(object):
def flick(self, element, x1, y1, x2, y2, duration=200): def flick(self, element, x1, y1, x2, y2, duration=200):
element = element.id element = element.id
time = 0 elapsed = 0
time_increment = 10 time_increment = 10
if time_increment >= duration: if time_increment >= duration:
time_increment = duration time_increment = duration
move_x = time_increment*1.0/duration * (x2 - x1) move_x = time_increment*1.0/duration * (x2 - x1)
move_y = time_increment*1.0/duration * (y2 - y1) move_y = time_increment*1.0/duration * (y2 - y1)
self.action_chain.append(['press', element, x1, y1]) self.action_chain.append(['press', element, x1, y1])
while (time < duration): while elapsed < duration:
time += time_increment elapsed += time_increment
self.action_chain.append(['moveByOffset', move_x, move_y]) self.action_chain.append(['moveByOffset', move_x, move_y])
self.action_chain.append(['wait', time_increment/1000]) self.action_chain.append(['wait', time_increment/1000])
self.action_chain.append(['release']) self.action_chain.append(['release'])

View File

@ -15,7 +15,7 @@ import weakref
import warnings import warnings
from errors import * from errors import *
from marionette import HTMLElement, Marionette from marionette import Marionette
class SkipTest(Exception): class SkipTest(Exception):
""" """

View File

@ -3,8 +3,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
from datetime import datetime from datetime import datetime
import imp
import inspect
import logging import logging
from optparse import OptionParser from optparse import OptionParser
import os import os
@ -13,10 +11,8 @@ import socket
import sys import sys
import time import time
import traceback import traceback
import platform
import moznetwork import moznetwork
import xml.dom.minidom as dom import xml.dom.minidom as dom
from functools import wraps
from manifestparser import TestManifest from manifestparser import TestManifest
from mozhttpd import MozHttpd from mozhttpd import MozHttpd

View File

@ -2,8 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import time from marionette import Marionette
from marionette import Marionette, HTMLElement
# #
# Test that Marionette can manage multiple emulators. # Test that Marionette can manage multiple emulators.