Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions AppiumLibrary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import os
from AppiumLibrary.keywords import *
from AppiumLibrary.version import VERSION
Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/keywords/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from ._logging import _LoggingKeywords
from ._runonfailure import _RunOnFailureKeywords
from ._element import _ElementKeywords
Expand Down
1 change: 0 additions & 1 deletion AppiumLibrary/keywords/_android_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import base64

from .keywordgroup import KeywordGroup
Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/keywords/_applicationmanagement.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import os
import robot
import inspect
Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/keywords/_element.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from AppiumLibrary.locators import ElementFinder
from appium.webdriver.common.appiumby import AppiumBy
from .keywordgroup import KeywordGroup
Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/keywords/_keyevent.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from .keywordgroup import KeywordGroup


Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/keywords/_logging.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import os
from robot.libraries.BuiltIn import BuiltIn
from robot.libraries.BuiltIn import RobotNotRunningError
Expand Down
6 changes: 2 additions & 4 deletions AppiumLibrary/keywords/_runonfailure.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from robot.libraries import BuiltIn
from .keywordgroup import KeywordGroup

Expand Down Expand Up @@ -36,8 +34,8 @@ def register_keyword_to_run_on_failure(self, keyword):
| ${previous kw}= | Register Keyword To Run On Failure | Nothing | # Disables run-on-failure functionality and stores the previous kw name in a variable. |
| Register Keyword To Run On Failure | ${previous kw} | # Restore to the previous keyword. |

This run-on-failure functionality only works when running tests on Python/Jython 2.4
or newer and it does not work on IronPython at all.
This run-on-failure functionality only works when running tests on Python 3.9
or newer.
"""
old_keyword = self._run_on_failure_keyword
old_keyword_text = old_keyword if old_keyword is not None else "Nothing"
Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/keywords/_screenrecord.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import os
import robot
import base64
Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/keywords/_screenshot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import os
import robot
from .keywordgroup import KeywordGroup
Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/keywords/_touch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import time

from appium.webdriver.extensions.action_helpers import ActionHelpers
Expand Down
22 changes: 7 additions & 15 deletions AppiumLibrary/keywords/keywordgroup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# -*- coding: utf-8 -*-

import sys
import inspect
from six import with_metaclass
try:
from decorator import decorator
except SyntaxError: # decorator module requires Python/Jython 2.4+
decorator = None
if sys.platform == 'cli':
decorator = None # decorator module doesn't work with IronPython 2.6

from decorator import decorator


def _run_on_failure_decorator(method, *args, **kwargs):
try:
Expand All @@ -22,12 +15,11 @@ def _run_on_failure_decorator(method, *args, **kwargs):

class KeywordGroupMetaClass(type):
def __new__(cls, clsname, bases, dict):
if decorator:
for name, method in dict.items():
if not name.startswith('_') and inspect.isroutine(method):
dict[name] = decorator(_run_on_failure_decorator, method)
for name, method in dict.items():
if not name.startswith('_') and inspect.isroutine(method):
dict[name] = decorator(_run_on_failure_decorator, method)
return type.__new__(cls, clsname, bases, dict)


class KeywordGroup(with_metaclass(KeywordGroupMetaClass, object)):
class KeywordGroup(object, metaclass=KeywordGroupMetaClass):
pass
2 changes: 0 additions & 2 deletions AppiumLibrary/locators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from .elementfinder import ElementFinder

__all__ = [
Expand Down
2 changes: 0 additions & 2 deletions AppiumLibrary/locators/elementfinder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from AppiumLibrary import utils
from appium.webdriver.common.appiumby import AppiumBy
from robot.api import logger
Expand Down
6 changes: 1 addition & 5 deletions AppiumLibrary/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import six

from .applicationcache import ApplicationCache

if six.PY3:
unicode = str

def escape_xpath_value(value):
value = unicode(value)
value = str(value)
if '"' in value and '\'' in value:
parts_wo_apos = value.split('\'')
return "concat('%s')" % "', \"'\", '".join(parts_wo_apos)
Expand Down
1 change: 0 additions & 1 deletion AppiumLibrary/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
VERSION = '3.2.1'
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies = [
"docutils >= 0.8.1",
"selenium >=4.26.0",
"Appium-Python-Client >= 5.1.1",
"six >= 1.10.0",
"geopy >= 2.4.1",
]
description = "Robot Framework Mobile app testing library for Appium Client Android & iOS & Web"
Expand Down
3 changes: 1 addition & 2 deletions test_require.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mock >= 2.0.0
pytest-cov >= 2.5.1
pytest-xdist >= 1.16.0
pytest >= 3.1.0
six >= 1.10.0
pytest >= 3.1.0
5 changes: 0 additions & 5 deletions tests/keywords/test_androidUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@


class AndroidUtilsTests(unittest.TestCase):
import six
if six.PY2:
assertRegex = unittest.TestCase.assertRegexpMatches
assertRaisesRegex = unittest.TestCase.assertRaisesRegexp

am = None
au = None

Expand Down
7 changes: 1 addition & 6 deletions tests/keywords/test_multipleAppiumConnections.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
logger.addHandler(stream_handler)

class MultipleAppiumConnectionTests(unittest.TestCase):
import six
if six.PY2:
assertRegex = unittest.TestCase.assertRegexpMatches
assertRaisesRegex = unittest.TestCase.assertRaisesRegexp

am=None
am = None

def setUp(self):
#appium.webdriver.Remote = mock.Mock()
Expand Down
5 changes: 0 additions & 5 deletions tests/utils/test_applicationcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@


class ApplicationCacheTests(unittest.TestCase):
import six
if six.PY2:
assertRegex = unittest.TestCase.assertRegexpMatches
assertRaisesRegex = unittest.TestCase.assertRaisesRegexp

def test_no_current_message(self):
cache = ApplicationCache()
with self.assertRaisesRegex(RuntimeError, "No current application"):
Expand Down