From 8e50b38caa19c406fb6f1a1d4fd258609fbead14 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 23 Jan 2026 13:20:18 +0100 Subject: [PATCH] MT#62763 Fix pycodestyle issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add pyproject.toml and update tox.ini. - Fix «== None» into «is None». - Fix escaping of |. - Fix misplaced spaces around commas. - Add explicit exception catching. Change-Id: I97199c4ed8a24dc870bab4178bf1c103e7f4e7e0 --- pyproject.toml | 7 +++++++ t/selenium/functions/Collections.py | 2 +- t/selenium/functions/Functions.py | 2 +- t/selenium/testrun.py | 8 ++++---- tox.ini | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..5c149670 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[tool.black] +# Match line-length expected by pycodestyle. +line-length = 200 +# Current version in Debian trixie. +target-version = ['py313'] +# Enable preview features, expected by pycodestyle. +preview = true diff --git a/t/selenium/functions/Collections.py b/t/selenium/functions/Collections.py index 4cb1b867..2e827764 100644 --- a/t/selenium/functions/Collections.py +++ b/t/selenium/functions/Collections.py @@ -31,7 +31,7 @@ def login_panel(driver): driver.implicitly_wait(1) driver.find_element(By.XPATH, '//*[@id="q-app"]/div/footer/div/button/span[2]/span').click() driver.implicitly_wait(10) - except: + except Exception: pass finally: driver.implicitly_wait(10) diff --git a/t/selenium/functions/Functions.py b/t/selenium/functions/Functions.py index 6e7eaf8a..7d385863 100644 --- a/t/selenium/functions/Functions.py +++ b/t/selenium/functions/Functions.py @@ -25,7 +25,7 @@ def click_js(driver, element): if element[:1] == "/": webelement = driver.find_element(By.XPATH, element) else: - webelement = driver.find_element(By.LINK_TEXT ,element) + webelement = driver.find_element(By.LINK_TEXT, element) driver.execute_script("arguments[0].click();", webelement) diff --git a/t/selenium/testrun.py b/t/selenium/testrun.py index 1fcc8944..702a6d13 100644 --- a/t/selenium/testrun.py +++ b/t/selenium/testrun.py @@ -46,7 +46,7 @@ def preparation(): del i for customer in customers.keys(): create_subscriber(driver, customer, customers[customer]) - if os.environ.get('vmtype') == None: + if os.environ.get('vmtype') is None: os.environ['vmtype'] = "CE" driver.quit() except Exception: @@ -625,19 +625,19 @@ class testrun(unittest.TestCase): wait_for_invisibility(driver, '//*[@id="csc-page-call-forwarding"]//button[contains(., "Add forwarding")]/span/svg') wait_for_invisibility(driver, '//*[@id="csc-wrapper-call-forwarding"]/div/div[2]/div[4]/svg') driver.find_element(By.XPATH, '//*[@id="csc-wrapper-call-forwarding"]/div[1]//div/span[contains(., "Number")]').click() - fill_element(driver, "/html/body//label//div//input", "checking asdфывфів123!@#$%^&*()_+[]\|}{;'\":,./?>alert('test') asdфывфів123!@#$%^&*()_+[]\\|}{;'\":,./?> 0, "Illegal call foward was created") wait_for_invisibility(driver, '//*[@id="csc-wrapper-call-forwarding"]/div/div[2]/div[4]/svg') driver.find_element(By.XPATH, '//*[@id="csc-wrapper-call-forwarding"]/div[2]//div/span[contains(., "Number")]').click() - fill_element(driver, "/html/body//label//div//input", "checking asdфывфів123!@#$%^&*()_+[]\|}{;'\":,./?>alert('test') asdфывфів123!@#$%^&*()_+[]\\|}{;'\":,./?> 0, "Illegal call foward was created") wait_for_invisibility(driver, '//*[@id="csc-wrapper-call-forwarding"]/div/div[2]/div[4]/svg') driver.find_element(By.XPATH, '//*[@id="csc-wrapper-call-forwarding"]/div[3]//div/span[contains(., "Number")]').click() - fill_element(driver, "/html/body//label//div//input", "checking asdфывфів123!@#$%^&*()_+[]\|}{;'\":,./?>alert('test') asdфывфів123!@#$%^&*()_+[]\\|}{;'\":,./?> 0, "Illegal call foward was created") diff --git a/tox.ini b/tox.ini index e4d8e9ac..119a611c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,2 +1,2 @@ -[pep8] +[pycodestyle] max-line-length = 200