From b2b5629a012a278437232f231bf31ae39cc24235 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Thu, 21 Mar 2019 12:58:52 +0000 Subject: [PATCH] Fix PEP-8 issues. --- .../pg_utilities_backup_restore_test.py | 3 --- .../query_tool_auto_complete_tests.py | 12 ++++++------ .../feature_tests/query_tool_journey_test.py | 6 +++--- web/pgadmin/feature_tests/query_tool_tests.py | 11 +++++------ web/regression/feature_utils/pgadmin_page.py | 14 +++++++------- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py index ffdda7bf8..739e7cf76 100644 --- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py +++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py @@ -83,9 +83,6 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest): status = self.page.find_by_css_selector( ".pg-bg-status-text").text - print("Debug: .pg-bg-status-text %s"%status) - - #.pg-bg-status-text self.assertEquals(status, "Successfully completed.") self.page.find_by_css_selector( diff --git a/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py b/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py index 4f6caf6ce..b36d23437 100644 --- a/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py +++ b/web/pgadmin/feature_tests/query_tool_auto_complete_tests.py @@ -176,11 +176,11 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest): Keys.CONTROL).send_keys(Keys.SPACE).key_up(Keys.CONTROL).perform() # if IntelliSense is present then verify this - if self.page.check_if_element_exist_by_xpath\ - ("//ul[@class='CodeMirror-hints default']", 2): + if self.page.check_if_element_exist_by_xpath( + "//ul[@class='CodeMirror-hints default']", 2): self.page.find_by_xpath( - "//ul[contains(@class, 'CodeMirror-hints') and " - "contains(., '" + expected_string + "')]") + "//ul[contains(@class, 'CodeMirror-hints') and " + "contains(., '" + expected_string + "')]") else: # if no IntelliSense is present it means there is only one option # so check if required string is present in codeMirror @@ -188,6 +188,6 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest): "//pre[@class=' CodeMirror-line ']/span") code_mirror_text = code_mirror.text - if not expected_string in code_mirror_text: + if expected_string not in code_mirror_text: raise Exception("Required String %s is not " - "present"%expected_string) + "present" % expected_string) diff --git a/web/pgadmin/feature_tests/query_tool_journey_test.py b/web/pgadmin/feature_tests/query_tool_journey_test.py index f13e6fadf..34a5ac715 100644 --- a/web/pgadmin/feature_tests/query_tool_journey_test.py +++ b/web/pgadmin/feature_tests/query_tool_journey_test.py @@ -93,14 +93,14 @@ class QueryToolJourneyTest(BaseFeatureTest): "does not exist", failed_history_detail_pane.text ) self.page.wait_for_element(lambda driver: driver - .find_element_by_css_selector - ("#query_list> .query-group>ul>li")) + .find_element_by_css_selector( + "#query_list> .query-group>ul>li")) # get the query history rows and click the previous query row which # was executed and verify it history_rows = self.driver.find_elements_by_css_selector( "#query_list> .query-group>ul>li") - print("the number of history_rows are 10 %s"%len(history_rows)) + print("the number of history_rows are 10 %s" % len(history_rows)) history_rows[1].click() selected_history_entry = self.page.find_by_css_selector( diff --git a/web/pgadmin/feature_tests/query_tool_tests.py b/web/pgadmin/feature_tests/query_tool_tests.py index 7f50f1e48..88ea9e151 100644 --- a/web/pgadmin/feature_tests/query_tool_tests.py +++ b/web/pgadmin/feature_tests/query_tool_tests.py @@ -183,7 +183,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( # wait for header of the table to be visible wait.until(EC.visibility_of_element_located( - (By.XPATH,'//div[@class="slick-header-columns"]'))) + (By.XPATH, '//div[@class="slick-header-columns"]'))) wait.until(EC.presence_of_element_located( (By.XPATH, @@ -209,7 +209,8 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( # wait for header of the table to be visible wait.until(EC.visibility_of_element_located( - (By.XPATH,'//div[@class="slick-header-columns"]'))) + (By.XPATH, '//div[@class="slick-header-columns"]'))) + # wait for first row to contain value wait.until(EC.presence_of_element_located( (By.XPATH, @@ -234,7 +235,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format( # wait for header of the table to be visible wait.until(EC.visibility_of_element_located( - (By.XPATH,'//div[@class="slick-header-columns"]'))) + (By.XPATH, '//div[@class="slick-header-columns"]'))) wait.until(EC.presence_of_element_located( (By.XPATH, @@ -426,9 +427,7 @@ SELECT relname FROM pg_class self.page.wait_for_query_tool_loading_indicator_to_disappear() - def _query_tool_auto_commit_enabled(self): - query = """-- 1. Enable auto commit. -- 2. END any open transaction. -- 3. Create table in public schema. @@ -749,7 +748,7 @@ SELECT 1, pg_sleep(300)""" show_jit = pg_cursor.fetchone() if show_jit[0] == 'on': jit_enabled = True - except: + except Exception as e: pass is_edb = False diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py index e09ceac1f..f531369cd 100644 --- a/web/regression/feature_utils/pgadmin_page.py +++ b/web/regression/feature_utils/pgadmin_page.py @@ -185,12 +185,12 @@ class PgadminPage: """The function will be used for opening Trees node only""" # get the element which contains 'aria-expanded' info - tables_expansion_ele =self.find_by_xpath("//div[div[div[div[div[div" - "[div[div[span[span[" - "(@class='aciTreeText') and " - "text()='Tables']]]]]]]]]]") + tables_expansion_ele = self.find_by_xpath("//div[div[div[div[div[div" + "[div[div[span[span[" + "(@class='aciTreeText') and " + "text()='Tables']]]]]]]]]]") - if tables_expansion_ele.get_attribute('aria-expanded') =='false': + if tables_expansion_ele.get_attribute('aria-expanded') == 'false': # button element of the Tables node to open it item_button = self.find_by_xpath( "//div[span[span[(@class='aciTreeText') and text()" @@ -394,9 +394,9 @@ class PgadminPage: element_found = False try: WebDriverWait(self.driver, timeout, .01).until( - EC.visibility_of_element_located((By.XPATH, xpath))) + EC.visibility_of_element_located((By.XPATH, xpath))) element_found = True - except: + except Exception as e: pass return element_found