From 10ae8c3fa4d006d569c113bf642a306983046923 Mon Sep 17 00:00:00 2001 From: Mark Mayo Date: Mon, 5 Dec 2022 12:04:17 +1300 Subject: [PATCH] updates for python 3 - removed unnecessary inheritance from object - removed unnecessary u prefix for strings - sorted some imports - converted strings into f-strings - simplified a conditional --- script/release.py | 42 +++++++++---------- test/functional/android/applications_tests.py | 6 +-- test/functional/android/chrome_tests.py | 2 +- .../android/context_switching_tests.py | 2 +- test/functional/android/remote_fs_tests.py | 2 +- .../search_context/find_by_image_tests.py | 2 +- test/functional/android/touch_action_tests.py | 12 +++--- test/functional/android/webelement_tests.py | 2 +- .../ios/helper/desired_capabilities.py | 2 +- test/functional/ios/helper/test_helper.py | 2 +- test/functional/mac/helper/test_helper.py | 2 +- test/unit/webdriver/app_test.py | 2 +- test/unit/webdriver/appium_service_test.py | 2 +- test/unit/webdriver/context_test.py | 2 +- test/unit/webdriver/device/activities_test.py | 2 +- test/unit/webdriver/device/clipboard_test.py | 2 +- test/unit/webdriver/device/common_test.py | 2 +- .../unit/webdriver/device/device_time_test.py | 2 +- test/unit/webdriver/device/display_test.py | 2 +- .../unit/webdriver/device/fingerprint_test.py | 2 +- test/unit/webdriver/device/gsm_test.py | 2 +- test/unit/webdriver/device/keyboard_test.py | 2 +- test/unit/webdriver/device/location_test.py | 2 +- test/unit/webdriver/device/lock_test.py | 2 +- test/unit/webdriver/device/power_test.py | 2 +- test/unit/webdriver/device/remote_fs_test.py | 2 +- test/unit/webdriver/device/shake_test.py | 2 +- test/unit/webdriver/device/sms_test.py | 2 +- .../unit/webdriver/device/system_bars_test.py | 2 +- test/unit/webdriver/execute_driver_test.py | 2 +- test/unit/webdriver/ime_test.py | 2 +- test/unit/webdriver/log_events_test.py | 2 +- test/unit/webdriver/log_test.py | 2 +- test/unit/webdriver/multi_action_test.py | 6 +-- test/unit/webdriver/network_test.py | 2 +- test/unit/webdriver/performance_test.py | 2 +- test/unit/webdriver/screen_record_test.py | 2 +- .../webdriver/search_context/android_test.py | 2 +- .../webdriver/search_context/windows_test.py | 2 +- test/unit/webdriver/settings_test.py | 2 +- test/unit/webdriver/touch_action_test.py | 6 +-- test/unit/webdriver/webdriver_test.py | 6 +-- test/unit/webdriver/webelement_test.py | 2 +- 43 files changed, 76 insertions(+), 76 deletions(-) diff --git a/script/release.py b/script/release.py index 9b0f0a83..3c74c1f9 100644 --- a/script/release.py +++ b/script/release.py @@ -36,7 +36,7 @@ def get_current_version(): current = ( io.open(os.path.join(os.path.dirname('__file__'), 'appium', 'version.py'), encoding='utf-8').read().rstrip() ) - print('The current version is {}, type a new one'.format(MESSAGE_YELLOW.format(current))) + print(f'The current version is {MESSAGE_YELLOW.format(current)}, type a new one') return current @@ -51,72 +51,72 @@ def get_new_version(): def update_version_file(version): new_version = VERSION_FORMAT.format(version) - with open(VERSION_FILE_PATH, 'w') as f: + with open(VERSION_FILE_PATH, 'w', encoding="utf-8") as f: f.write(new_version) def call_bash_script(cmd): if os.environ.get('DRY_RUN') is not None: - print('{} Calls: {}'.format(MESSAGE_RED.format('[DRY_RUN]'), cmd)) + print(f"{MESSAGE_RED.format('[DRY_RUN]')} Calls: {cmd}") else: os.system(cmd) def commit_version_code(new_version_num): - call_bash_script('git commit {} -m "Bump {}"'.format(VERSION_FILE_PATH, new_version_num)) + call_bash_script(f'git commit {VERSION_FILE_PATH} -m "Bump {new_version_num}"') def tag_and_generate_changelog(new_version_num): - call_bash_script('git tag "v{}"'.format(new_version_num)) - call_bash_script('gitchangelog > {}'.format(CHANGELOG_PATH)) - call_bash_script('git commit {} -m "Update changelog for {}"'.format(CHANGELOG_PATH, new_version_num)) + call_bash_script(f'git tag "v{new_version_num}"') + call_bash_script(f'gitchangelog > {CHANGELOG_PATH}') + call_bash_script(f'git commit {CHANGELOG_PATH} -m "Update changelog for {new_version_num}"') def upload_sdist(new_version_num): - push_file = 'dist/Appium-Python-Client-{}.tar.gz'.format(new_version_num) + push_file = f'dist/Appium-Python-Client-{new_version_num}.tar.gz' try: - call_bash_script('twine upload "{}"'.format(push_file)) + call_bash_script(f'twine upload "{push_file}"') except Exception as e: print( - 'Failed to upload {} to pypi. ' - 'Please fix the original error and push it again later. Original error: {}'.format(push_file, e) + f'Failed to upload {push_file} to pypi. ' + f'Please fix the original error and push it again later. Original error: {e}' ) def push_changes_to_master(new_version_num): call_bash_script('git push origin master') - call_bash_script('git push origin "v{}"'.format(new_version_num)) + call_bash_script(f'git push origin "v{new_version_num}"') def ensure_publication(new_version_num): if os.environ.get('DRY_RUN') is not None: - print('Run with {} mode.'.format(MESSAGE_RED.format('[DRY_RUN]'))) + print(f"Run with {MESSAGE_RED.format('[DRY_RUN]')} mode.") - print('Are you sure to release as {}?[y/n]'.format(MESSAGE_YELLOW.format(new_version_num))) + print(f'Are you sure to release as {MESSAGE_YELLOW.format(new_version_num)}?[y/n]') for line in sys.stdin: if line.rstrip().lower() == 'y': return - exit('Canceled release process.') + sys.exit('Canceled release process.') def build_sdist(): - call_bash_script('{} setup.py sdist'.format(sys.executable)) + call_bash_script(f'{sys.executable} setup.py sdist') def validate_release_env(): if os.system('which twine') != 0: - exit("Please get twine via 'pip install twine'") + sys.exit("Please get twine via 'pip install twine'") if os.system('which gitchangelog') != 0: - exit( + sys.exit( "Please get twine via 'pip install gitchangelog' or 'pip install git+git://github.com/vaab/gitchangelog.git' for Python 3.7" ) def build() -> None: shutil.rmtree(BUILT_APPIUM_DIR_PATH, ignore_errors=True) - status, output = subprocess.getstatusoutput('{} setup.py install'.format(os.getenv('PYTHON_BIN_PATH'))) + status, output = subprocess.getstatusoutput(f"{os.getenv('PYTHON_BIN_PATH')} setup.py install") if status != 0: - exit(f'Failed to build the package:\n{output}') + sys.exit(f'Failed to build the package:\n{output}') def get_py_files_in_dir(root_dir: str) -> List[str]: @@ -144,7 +144,7 @@ def assert_files_count_in_package() -> None: if diff: print(f"{BUILT_APPIUM_DIR_PATH} has {diff} files than {APPIUM_DIR_PATH}") - exit( + sys.exit( f"Python files in '{BUILT_APPIUM_DIR_PATH}' may differ from '{APPIUM_DIR_PATH}'. " "Please make sure setup.py is configured properly." ) diff --git a/test/functional/android/applications_tests.py b/test/functional/android/applications_tests.py index 02ebcfc8..5c2adc08 100644 --- a/test/functional/android/applications_tests.py +++ b/test/functional/android/applications_tests.py @@ -61,15 +61,15 @@ def test_app_management(self) -> None: def test_app_strings(self) -> None: strings = self.driver.app_strings() - assert u'You can\'t wipe my data, you are a monkey!' == strings[u'monkey_wipe_data'] + assert 'You can\'t wipe my data, you are a monkey!' == strings['monkey_wipe_data'] def test_app_strings_with_language(self) -> None: strings = self.driver.app_strings('en') - assert u'You can\'t wipe my data, you are a monkey!' == strings[u'monkey_wipe_data'] + assert 'You can\'t wipe my data, you are a monkey!' == strings['monkey_wipe_data'] def test_app_strings_with_language_and_file(self) -> None: strings = self.driver.app_strings('en', 'some_file') - assert u'You can\'t wipe my data, you are a monkey!' == strings[u'monkey_wipe_data'] + assert 'You can\'t wipe my data, you are a monkey!' == strings['monkey_wipe_data'] def test_reset(self) -> None: self.driver.reset() diff --git a/test/functional/android/chrome_tests.py b/test/functional/android/chrome_tests.py index cf0ccae5..e79bacf5 100644 --- a/test/functional/android/chrome_tests.py +++ b/test/functional/android/chrome_tests.py @@ -20,7 +20,7 @@ from .helper.desired_capabilities import get_desired_capabilities -class TestChrome(object): +class TestChrome(): def setup_method(self) -> None: caps = get_desired_capabilities() caps['browserName'] = 'Chrome' diff --git a/test/functional/android/context_switching_tests.py b/test/functional/android/context_switching_tests.py index a8320d84..65caeaeb 100644 --- a/test/functional/android/context_switching_tests.py +++ b/test/functional/android/context_switching_tests.py @@ -24,7 +24,7 @@ @pytest.mark.skip(reason="Need to fix broken test") -class TestContextSwitching(object): +class TestContextSwitching(): def setup_method(self) -> None: caps = desired_capabilities.get_desired_capabilities('selendroid-test-app.apk') self.driver = webdriver.Remote(SERVER_URL_BASE, options=AppiumOptions().load_capabilities(caps)) diff --git a/test/functional/android/remote_fs_tests.py b/test/functional/android/remote_fs_tests.py index a71fe30c..838c5608 100644 --- a/test/functional/android/remote_fs_tests.py +++ b/test/functional/android/remote_fs_tests.py @@ -32,7 +32,7 @@ def test_push_pull_file(self) -> None: assert data == data_ret def test_pull_folder(self) -> None: - data = bytes('random string data {}'.format(random.randint(0, 1000)), 'utf-8') + data = bytes(f'random string data {random.randint(0, 1000)}', 'utf-8') dest_dir = '/data/local/tmp/' for filename in ['1.txt', '2.txt']: diff --git a/test/functional/android/search_context/find_by_image_tests.py b/test/functional/android/search_context/find_by_image_tests.py index 2ac4354a..04ebd276 100644 --- a/test/functional/android/search_context/find_by_image_tests.py +++ b/test/functional/android/search_context/find_by_image_tests.py @@ -25,7 +25,7 @@ from test.helpers.constants import SERVER_URL_BASE -class TestFindByImage(object): +class TestFindByImage(): def setup_method(self) -> None: caps = desired_capabilities.get_desired_capabilities('ApiDemos-debug.apk.zip') self.driver = webdriver.Remote(SERVER_URL_BASE, options=AppiumOptions().load_capabilities(caps)) diff --git a/test/functional/android/touch_action_tests.py b/test/functional/android/touch_action_tests.py index a97b992e..fbc2970e 100644 --- a/test/functional/android/touch_action_tests.py +++ b/test/functional/android/touch_action_tests.py @@ -131,13 +131,13 @@ def test_drag_and_drop(self) -> None: el = wait_for_element(self.driver, AppiumBy.ACCESSIBILITY_ID, 'Drag and Drop') action.tap(el).perform() - dd3 = wait_for_element(self.driver, AppiumBy.ID, '{}:id/drag_dot_3'.format(APIDEMO_PKG_NAME)) - dd2 = self.driver.find_element(by=AppiumBy.ID, value='{}:id/drag_dot_2'.format(APIDEMO_PKG_NAME)) + dd3 = wait_for_element(self.driver, AppiumBy.ID, f'{APIDEMO_PKG_NAME}:id/drag_dot_3') + dd2 = self.driver.find_element(by=AppiumBy.ID, value=f'{APIDEMO_PKG_NAME}:id/drag_dot_2') # dnd is stimulated by longpress-move_to-release action.long_press(dd3).move_to(dd2).release().perform() - el = wait_for_element(self.driver, AppiumBy.ID, '{}:id/drag_result_text'.format(APIDEMO_PKG_NAME)) + el = wait_for_element(self.driver, AppiumBy.ID, f'{APIDEMO_PKG_NAME}:id/drag_result_text') assert 'Dropped!' in el.text def test_driver_drag_and_drop(self) -> None: @@ -147,12 +147,12 @@ def test_driver_drag_and_drop(self) -> None: el = wait_for_element(self.driver, AppiumBy.ACCESSIBILITY_ID, 'Drag and Drop') action.tap(el).perform() - dd3 = wait_for_element(self.driver, AppiumBy.ID, '{}:id/drag_dot_3'.format(APIDEMO_PKG_NAME)) - dd2 = self.driver.find_element(by=AppiumBy.ID, value='{}:id/drag_dot_2'.format(APIDEMO_PKG_NAME)) + dd3 = wait_for_element(self.driver, AppiumBy.ID, f'{APIDEMO_PKG_NAME}:id/drag_dot_3') + dd2 = self.driver.find_element(by=AppiumBy.ID, value=f'{APIDEMO_PKG_NAME}:id/drag_dot_2') self.driver.drag_and_drop(dd3, dd2) - el = wait_for_element(self.driver, AppiumBy.ID, '{}:id/drag_result_text'.format(APIDEMO_PKG_NAME)) + el = wait_for_element(self.driver, AppiumBy.ID, f'{APIDEMO_PKG_NAME}:id/drag_result_text') assert 'Dropped!' in el.text def test_driver_swipe(self) -> None: diff --git a/test/functional/android/webelement_tests.py b/test/functional/android/webelement_tests.py index 989521e5..a60327b1 100644 --- a/test/functional/android/webelement_tests.py +++ b/test/functional/android/webelement_tests.py @@ -45,7 +45,7 @@ def test_send_keys(self) -> None: for text in ['App', 'Activity', 'Custom Title']: wait_for_element(self.driver, AppiumBy.XPATH, f"//android.widget.TextView[@text='{text}']").click() - el = wait_for_element(self.driver, AppiumBy.ID, '{}:id/left_text_edit'.format(APIDEMO_PKG_NAME)) + el = wait_for_element(self.driver, AppiumBy.ID, f'{APIDEMO_PKG_NAME}:id/left_text_edit') el.send_keys(' text') assert 'Left is best text' == el.text diff --git a/test/functional/ios/helper/desired_capabilities.py b/test/functional/ios/helper/desired_capabilities.py index fc9aa0b7..aa6412a7 100644 --- a/test/functional/ios/helper/desired_capabilities.py +++ b/test/functional/ios/helper/desired_capabilities.py @@ -73,7 +73,7 @@ def iphone_device_name() -> str: prefix = 'iPhone 12' if PytestXdistWorker.NUMBER == PytestXdistWorker.gw(0): return f'{prefix} - 8100' - elif PytestXdistWorker.NUMBER == PytestXdistWorker.gw(1): + if PytestXdistWorker.NUMBER == PytestXdistWorker.gw(1): return f'{prefix} - 8101' return prefix diff --git a/test/functional/ios/helper/test_helper.py b/test/functional/ios/helper/test_helper.py index 2a975aa5..00207b2c 100644 --- a/test/functional/ios/helper/test_helper.py +++ b/test/functional/ios/helper/test_helper.py @@ -23,7 +23,7 @@ from . import desired_capabilities -class BaseTestCase(object): +class BaseTestCase(): def setup_method(self) -> None: desired_caps = desired_capabilities.get_desired_capabilities('UICatalog.app.zip') self.driver = webdriver.Remote(SERVER_URL_BASE, options=XCUITestOptions().load_capabilities(desired_caps)) diff --git a/test/functional/mac/helper/test_helper.py b/test/functional/mac/helper/test_helper.py index 1e5e4c3b..6d986080 100644 --- a/test/functional/mac/helper/test_helper.py +++ b/test/functional/mac/helper/test_helper.py @@ -19,7 +19,7 @@ from .desired_capabilities import get_desired_capabilities -class BaseTestCase(object): +class BaseTestCase(): def setup_method(self) -> None: self.driver = webdriver.Remote( SERVER_URL_BASE, options=Mac2Options().load_capabilities(get_desired_capabilities()) diff --git a/test/unit/webdriver/app_test.py b/test/unit/webdriver/app_test.py index 02bbb8df..5f169c38 100644 --- a/test/unit/webdriver/app_test.py +++ b/test/unit/webdriver/app_test.py @@ -19,7 +19,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverApp(object): +class TestWebDriverApp(): @httpretty.activate def test_reset(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/appium_service_test.py b/test/unit/webdriver/appium_service_test.py index 763a6a37..bd16d043 100644 --- a/test/unit/webdriver/appium_service_test.py +++ b/test/unit/webdriver/appium_service_test.py @@ -15,6 +15,6 @@ from appium.webdriver.appium_service import AppiumService -class TestAppiumService(object): +class TestAppiumService(): def test_get_instance(self): assert AppiumService() diff --git a/test/unit/webdriver/context_test.py b/test/unit/webdriver/context_test.py index 16ab9dc1..965bbfdb 100644 --- a/test/unit/webdriver/context_test.py +++ b/test/unit/webdriver/context_test.py @@ -17,7 +17,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command -class TestWebDriverContext(object): +class TestWebDriverContext(): @httpretty.activate def test_get_contexts(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/activities_test.py b/test/unit/webdriver/device/activities_test.py index b64a10d6..d1b23e24 100644 --- a/test/unit/webdriver/device/activities_test.py +++ b/test/unit/webdriver/device/activities_test.py @@ -17,7 +17,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverActivities(object): +class TestWebDriverActivities(): @httpretty.activate def test_start_activity(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/clipboard_test.py b/test/unit/webdriver/device/clipboard_test.py index 44b346e1..5ab70cdf 100644 --- a/test/unit/webdriver/device/clipboard_test.py +++ b/test/unit/webdriver/device/clipboard_test.py @@ -18,7 +18,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body, ios_w3c_driver -class TestWebDriverClipboard(object): +class TestWebDriverClipboard(): @httpretty.activate def test_set_clipboard_with_url(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/common_test.py b/test/unit/webdriver/device/common_test.py index 3d9b2283..d690d5db 100644 --- a/test/unit/webdriver/device/common_test.py +++ b/test/unit/webdriver/device/common_test.py @@ -18,7 +18,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command -class TestWebDriverCommon(object): +class TestWebDriverCommon(): @httpretty.activate def test_open_notifications(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/device_time_test.py b/test/unit/webdriver/device/device_time_test.py index 59b5dcb9..b9abf5be 100644 --- a/test/unit/webdriver/device/device_time_test.py +++ b/test/unit/webdriver/device/device_time_test.py @@ -17,7 +17,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverDeviceTime(object): +class TestWebDriverDeviceTime(): @httpretty.activate def test_device_time(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/display_test.py b/test/unit/webdriver/device/display_test.py index 92789607..f720091a 100644 --- a/test/unit/webdriver/device/display_test.py +++ b/test/unit/webdriver/device/display_test.py @@ -17,7 +17,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command -class TestWebDriverDisplay(object): +class TestWebDriverDisplay(): @httpretty.activate def test_get_display_density(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/fingerprint_test.py b/test/unit/webdriver/device/fingerprint_test.py index b4d3b6e7..0838c026 100644 --- a/test/unit/webdriver/device/fingerprint_test.py +++ b/test/unit/webdriver/device/fingerprint_test.py @@ -17,7 +17,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverFingerprint(object): +class TestWebDriverFingerprint(): @httpretty.activate def test_finger_print(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/gsm_test.py b/test/unit/webdriver/device/gsm_test.py index f6ad5ee0..0c0e56a7 100644 --- a/test/unit/webdriver/device/gsm_test.py +++ b/test/unit/webdriver/device/gsm_test.py @@ -19,7 +19,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriveGsm(object): +class TestWebDriveGsm(): @httpretty.activate def test_make_gsm_call(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/keyboard_test.py b/test/unit/webdriver/device/keyboard_test.py index 91de8cd8..b21f76d6 100644 --- a/test/unit/webdriver/device/keyboard_test.py +++ b/test/unit/webdriver/device/keyboard_test.py @@ -18,7 +18,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverKeyboard(object): +class TestWebDriverKeyboard(): @httpretty.activate def test_hide_keyboard(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/location_test.py b/test/unit/webdriver/device/location_test.py index c351c2f4..285f252a 100644 --- a/test/unit/webdriver/device/location_test.py +++ b/test/unit/webdriver/device/location_test.py @@ -20,7 +20,7 @@ FLT_EPSILON = 1e-9 -class TestWebDriverLocation(object): +class TestWebDriverLocation(): @httpretty.activate def test_toggle_location_services(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/lock_test.py b/test/unit/webdriver/device/lock_test.py index cecc5683..41012cec 100644 --- a/test/unit/webdriver/device/lock_test.py +++ b/test/unit/webdriver/device/lock_test.py @@ -18,7 +18,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverLock(object): +class TestWebDriverLock(): @httpretty.activate def test_lock(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/power_test.py b/test/unit/webdriver/device/power_test.py index 7a5254c4..301dc79a 100644 --- a/test/unit/webdriver/device/power_test.py +++ b/test/unit/webdriver/device/power_test.py @@ -19,7 +19,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverPower(object): +class TestWebDriverPower(): @httpretty.activate def test_set_power_capacity(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/remote_fs_test.py b/test/unit/webdriver/device/remote_fs_test.py index cab63f9f..a6afdf4a 100644 --- a/test/unit/webdriver/device/remote_fs_test.py +++ b/test/unit/webdriver/device/remote_fs_test.py @@ -22,7 +22,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverRemoteFs(object): +class TestWebDriverRemoteFs(): @httpretty.activate def test_push_file(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/shake_test.py b/test/unit/webdriver/device/shake_test.py index d60e70b5..efafcb69 100644 --- a/test/unit/webdriver/device/shake_test.py +++ b/test/unit/webdriver/device/shake_test.py @@ -19,7 +19,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command -class TestWebDriverShake(object): +class TestWebDriverShake(): @httpretty.activate def test_shake(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/sms_test.py b/test/unit/webdriver/device/sms_test.py index 5e3fb200..8668bc2b 100644 --- a/test/unit/webdriver/device/sms_test.py +++ b/test/unit/webdriver/device/sms_test.py @@ -18,7 +18,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverSms(object): +class TestWebDriverSms(): @httpretty.activate def test_send_sms(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/device/system_bars_test.py b/test/unit/webdriver/device/system_bars_test.py index 6799733e..1813adf2 100644 --- a/test/unit/webdriver/device/system_bars_test.py +++ b/test/unit/webdriver/device/system_bars_test.py @@ -17,7 +17,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command -class TestWebDriverSystemBars(object): +class TestWebDriverSystemBars(): @httpretty.activate def test_get_system_bars(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/execute_driver_test.py b/test/unit/webdriver/execute_driver_test.py index 250b8cc8..14c31e30 100644 --- a/test/unit/webdriver/execute_driver_test.py +++ b/test/unit/webdriver/execute_driver_test.py @@ -19,7 +19,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverExecuteDriver(object): +class TestWebDriverExecuteDriver(): @httpretty.activate def test_batch(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/ime_test.py b/test/unit/webdriver/ime_test.py index d9e80c35..7f2c7f0f 100644 --- a/test/unit/webdriver/ime_test.py +++ b/test/unit/webdriver/ime_test.py @@ -21,7 +21,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverIme(object): +class TestWebDriverIme(): @httpretty.activate def test_available_ime_engines(self): ANDROID_LATIN = 'com.android.inputmethod.latin/.LatinIME' diff --git a/test/unit/webdriver/log_events_test.py b/test/unit/webdriver/log_events_test.py index 6da85d63..21975054 100644 --- a/test/unit/webdriver/log_events_test.py +++ b/test/unit/webdriver/log_events_test.py @@ -20,7 +20,7 @@ from test.unit.helper.test_helper import appium_command, get_httpretty_request_body, ios_w3c_driver -class TestWebDriverLogEvents(object): +class TestWebDriverLogEvents(): @httpretty.activate def test_get_events(self): driver = ios_w3c_driver() diff --git a/test/unit/webdriver/log_test.py b/test/unit/webdriver/log_test.py index 3c63f657..1ea3c377 100644 --- a/test/unit/webdriver/log_test.py +++ b/test/unit/webdriver/log_test.py @@ -20,7 +20,7 @@ from test.unit.helper.test_helper import appium_command, get_httpretty_request_body, ios_w3c_driver -class TestWebDriverLog(object): +class TestWebDriverLog(): @httpretty.activate def test_get_log_types(self): driver = ios_w3c_driver() diff --git a/test/unit/webdriver/multi_action_test.py b/test/unit/webdriver/multi_action_test.py index 4f956eaa..02e11dc7 100644 --- a/test/unit/webdriver/multi_action_test.py +++ b/test/unit/webdriver/multi_action_test.py @@ -18,7 +18,7 @@ from appium.webdriver.common.touch_action import TouchAction -class TestMultiAction(object): +class TestMultiAction(): @pytest.fixture def multi_action(self): return MultiAction(DriverStub()) @@ -44,12 +44,12 @@ def test_json(self, multi_action): assert json == multi_action.json_wire_gestures -class DriverStub(object): +class DriverStub(): def execute(self, _action, _params): print("driver.execute called") -class ElementStub(object): +class ElementStub(): def __init__(self, e_id): self._id = e_id diff --git a/test/unit/webdriver/network_test.py b/test/unit/webdriver/network_test.py index c903db40..ecfca49d 100644 --- a/test/unit/webdriver/network_test.py +++ b/test/unit/webdriver/network_test.py @@ -20,7 +20,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverNetwork(object): +class TestWebDriverNetwork(): @httpretty.activate def test_network_connection(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/performance_test.py b/test/unit/webdriver/performance_test.py index 78d62756..f95ef9f9 100644 --- a/test/unit/webdriver/performance_test.py +++ b/test/unit/webdriver/performance_test.py @@ -17,7 +17,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverPerformance(object): +class TestWebDriverPerformance(): @httpretty.activate def test_get_performance_data(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/screen_record_test.py b/test/unit/webdriver/screen_record_test.py index 38054553..ee05e0e8 100644 --- a/test/unit/webdriver/screen_record_test.py +++ b/test/unit/webdriver/screen_record_test.py @@ -12,7 +12,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverScreenRecord(object): +class TestWebDriverScreenRecord(): @httpretty.activate def test_start_recording_screen(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/search_context/android_test.py b/test/unit/webdriver/search_context/android_test.py index c40735fc..ea23c61e 100644 --- a/test/unit/webdriver/search_context/android_test.py +++ b/test/unit/webdriver/search_context/android_test.py @@ -21,7 +21,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverAndroidSearchContext(object): +class TestWebDriverAndroidSearchContext(): @httpretty.activate def test_find_element_by_android_data_matcher(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/search_context/windows_test.py b/test/unit/webdriver/search_context/windows_test.py index 2fcc099e..b305fb98 100644 --- a/test/unit/webdriver/search_context/windows_test.py +++ b/test/unit/webdriver/search_context/windows_test.py @@ -20,7 +20,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverWindowsSearchContext(object): +class TestWebDriverWindowsSearchContext(): @httpretty.activate def test_find_element_by_windows_uiautomation(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/settings_test.py b/test/unit/webdriver/settings_test.py index 5f60904e..5d13594d 100644 --- a/test/unit/webdriver/settings_test.py +++ b/test/unit/webdriver/settings_test.py @@ -18,7 +18,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebDriverSettings(object): +class TestWebDriverSettings(): @httpretty.activate def test_get_settings_bool(self): driver = android_w3c_driver() diff --git a/test/unit/webdriver/touch_action_test.py b/test/unit/webdriver/touch_action_test.py index 9bdb7784..1445eacf 100644 --- a/test/unit/webdriver/touch_action_test.py +++ b/test/unit/webdriver/touch_action_test.py @@ -17,7 +17,7 @@ from appium.webdriver.common.touch_action import TouchAction -class TestTouchAction(object): +class TestTouchAction(): @pytest.fixture def touch_action(self): return TouchAction(DriverStub()) @@ -85,12 +85,12 @@ def test_perform_json(self, touch_action): assert [] == touch_action.json_wire_gestures -class DriverStub(object): +class DriverStub(): def execute(self, _action, _params): print("driver.execute called") -class ElementStub(object): +class ElementStub(): def __init__(self, e_id, _x=None, _y=None, _count=None): self._id = e_id diff --git a/test/unit/webdriver/webdriver_test.py b/test/unit/webdriver/webdriver_test.py index 51ea40d9..db0781a2 100644 --- a/test/unit/webdriver/webdriver_test.py +++ b/test/unit/webdriver/webdriver_test.py @@ -31,7 +31,7 @@ ) -class TestWebDriverWebDriver(object): +class TestWebDriverWebDriver(): @httpretty.activate def test_create_session(self): httpretty.register_uri( @@ -52,7 +52,7 @@ def test_create_session(self): request = httpretty.HTTPretty.latest_requests[0] assert request.headers['content-type'] == 'application/json;charset=UTF-8' - assert 'appium/python {} (selenium'.format(appium_version.version) in request.headers['user-agent'] + assert f'appium/python {appium_version.version} (selenium' in request.headers['user-agent'] request_json = json.loads(httpretty.HTTPretty.latest_requests[0].body.decode('utf-8')) assert request_json.get('capabilities') is not None @@ -319,7 +319,7 @@ def __init__(self, command_executor, desired_capabilities=None, direct_connectio ) -class TestSubModuleWebDriver(object): +class TestSubModuleWebDriver(): def android_w3c_driver(self, driver_class): response_body_json = json.dumps( { diff --git a/test/unit/webdriver/webelement_test.py b/test/unit/webdriver/webelement_test.py index 59464fd8..d5e9241d 100644 --- a/test/unit/webdriver/webelement_test.py +++ b/test/unit/webdriver/webelement_test.py @@ -22,7 +22,7 @@ from test.unit.helper.test_helper import android_w3c_driver, appium_command, get_httpretty_request_body -class TestWebElement(object): +class TestWebElement(): @httpretty.activate def test_set_value(self): driver = android_w3c_driver()