Skip to content

Commit 4c166f4

Browse files
refactor: Remove previously deprecated methods and mark reset/close/launch APIs as deprecated (#738)
1 parent 50458bb commit 4c166f4

File tree

13 files changed

+35
-688
lines changed

13 files changed

+35
-688
lines changed

appium/webdriver/common/multi_action.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
# chaining as the spec requires.
2020

2121
import copy
22+
import warnings
2223
from typing import TYPE_CHECKING, Dict, List, Optional, Union
2324

24-
from appium.common.logger import logger
2525
from appium.webdriver.mobilecommand import MobileCommand as Command
2626

2727
if TYPE_CHECKING:
@@ -37,7 +37,9 @@ class MultiAction:
3737
"""
3838

3939
def __init__(self, driver: 'WebDriver', element: Optional['WebElement'] = None) -> None:
40-
logger.warning("[Deprecated] 'MultiAction' action is deprecated. Please use W3C actions instead.")
40+
warnings.warn(
41+
"[Deprecated] 'MultiAction' action is deprecated. Please use W3C actions instead.", DeprecationWarning
42+
)
4143

4244
self._driver = driver
4345
self._element = element

appium/webdriver/common/touch_action.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
# pylint: disable=no-self-use
2525

2626
import copy
27+
import warnings
2728
from typing import TYPE_CHECKING, Dict, List, Optional, Union
2829

29-
from appium.common.logger import logger
3030
from appium.webdriver.mobilecommand import MobileCommand as Command
3131

3232
if TYPE_CHECKING:
@@ -41,7 +41,9 @@ class TouchAction:
4141
"""
4242

4343
def __init__(self, driver: Optional['WebDriver'] = None):
44-
logger.warning("[Deprecated] 'TouchAction' action is deprecated. Please use W3C actions instead.")
44+
warnings.warn(
45+
"[Deprecated] 'TouchAction' action is deprecated. Please use W3C actions instead.", DeprecationWarning
46+
)
4547

4648
self._driver = driver
4749
self._actions: List = []

appium/webdriver/extensions/applications.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
import warnings
1515
from typing import TYPE_CHECKING, Any, Dict
1616

1717
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
@@ -106,20 +106,34 @@ def remove_app(self, app_id: str, **options: Any) -> 'WebDriver':
106106

107107
def launch_app(self) -> 'WebDriver':
108108
"""Start on the device the application specified in the desired capabilities.
109+
deprecated:: 2.0.0
109110
110111
Returns:
111112
Union['WebDriver', 'Applications']: Self instance
112113
"""
114+
warnings.warn(
115+
'The "launchApp" API is deprecated and will be removed in future versions. '
116+
'See https://github.com/appium/appium/issues/15807',
117+
DeprecationWarning,
118+
)
119+
113120
self.execute(Command.LAUNCH_APP)
114121
return self # type: ignore
115122

116123
def close_app(self) -> 'WebDriver':
117124
"""Stop the running application, specified in the desired capabilities, on
118125
the device.
126+
deprecated:: 2.0.0
119127
120128
Returns:
121129
Union['WebDriver', 'Applications']: Self instance
122130
"""
131+
warnings.warn(
132+
'The "closeApp" API is deprecated and will be removed in future versions. '
133+
'See https://github.com/appium/appium/issues/15807',
134+
DeprecationWarning,
135+
)
136+
123137
self.execute(Command.CLOSE_APP)
124138
return self # type: ignore
125139

@@ -194,10 +208,17 @@ def app_strings(self, language: str = None, string_file: str = None) -> Dict[str
194208

195209
def reset(self) -> 'WebDriver':
196210
"""Resets the current application on the device.
211+
deprecated:: 2.0.0
197212
198213
Returns:
199214
Union['WebDriver', 'Applications']: Self instance
200215
"""
216+
warnings.warn(
217+
'The "reset" API is deprecated and will be removed in future versions. '
218+
'See https://github.com/appium/appium/issues/15807',
219+
DeprecationWarning,
220+
)
221+
201222
self.execute(Command.RESET)
202223
return self # type: ignore
203224

appium/webdriver/extensions/search_context/__init__.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

appium/webdriver/extensions/search_context/android.py

Lines changed: 0 additions & 237 deletions
This file was deleted.

0 commit comments

Comments
 (0)