Skip to content

Commit d8e24f9

Browse files
alvarolasernaAlvaro Laserna
andauthored
add deprecation notice for touch actions (#95)
* add deprecation notice for touch actions * fix deprecated method * fix formatting --------- Co-authored-by: Alvaro Laserna <alvarolaserna@MacBook-Pro-2.local>
1 parent 6930d22 commit d8e24f9

1 file changed

Lines changed: 30 additions & 13 deletions

File tree

testui/support/testui_driver.py

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import base64
22
import os
3+
import warnings
34

45
from datetime import datetime
56
from os import path
@@ -17,6 +18,21 @@
1718
from testui.support.configuration import Configuration
1819

1920

21+
def deprecated(message):
22+
def decorator(func):
23+
def wrapper(*args, **kwargs):
24+
warnings.warn(
25+
f"{func.__name__} is deprecated: {message}",
26+
category=DeprecationWarning,
27+
stacklevel=2
28+
)
29+
return func(*args, **kwargs)
30+
31+
return wrapper
32+
33+
return decorator
34+
35+
2036
class TestUIDriver:
2137
"""
2238
This class is the main class for the TestUI framework. It is used to
@@ -120,6 +136,7 @@ def remove_log_file(self, when_no_errors=True):
120136
logger.log_debug("Log file already removed")
121137
return self
122138

139+
@deprecated("This method is deprecated and will be removed in a future version. Use actions() instead")
123140
def touch_actions(self) -> TouchAction:
124141
"""
125142
Deprecated function, soon to be removed, use actions instead.
@@ -212,12 +229,12 @@ def network_connection(self) -> int:
212229
return self.driver.network_connection
213230

214231
def find_image_match(
215-
self,
216-
comparison,
217-
threshold=0.90,
218-
assertion=False,
219-
not_found=False,
220-
image_match="",
232+
self,
233+
comparison,
234+
threshold=0.90,
235+
assertion=False,
236+
not_found=False,
237+
image_match="",
221238
) -> bool:
222239
"""
223240
Will find an image match based on the comparison type and threshold
@@ -476,13 +493,13 @@ def stop_recording_screen(self, file_name="testui-video.mp4"):
476493
return self
477494

478495
def stop_recording_and_compare(
479-
self,
480-
comparison,
481-
threshold=0.9,
482-
fps_reduction=1,
483-
not_found=False,
484-
keep_image_as="",
485-
assertion=True,
496+
self,
497+
comparison,
498+
threshold=0.9,
499+
fps_reduction=1,
500+
not_found=False,
501+
keep_image_as="",
502+
assertion=True,
486503
) -> bool:
487504
"""
488505
Stop recording the screen and compare the video with the given image

0 commit comments

Comments
 (0)