From 0114d46fc138e6553aaf64b2c9a2e83689b7c86e Mon Sep 17 00:00:00 2001 From: Douglas Cardoso <29078346+douglasdcm@users.noreply.github.com> Date: Sun, 2 Feb 2025 01:22:41 -0300 Subject: [PATCH 1/5] Add pre-commit configuration --- .pre-commit-config.yaml | 7 +++++++ test-requirements.txt | 1 + 2 files changed, 8 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2cdd73a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + args: [--line-length=100] + language_version: python3.11 diff --git a/test-requirements.txt b/test-requirements.txt index c72dff9..b5c6cce 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,6 +3,7 @@ pytest-xdist pytest-asyncio flake8 black +pre-commit requests caqui tox From 80f9421455706d6cb2aeef29bb20246406c9ed49 Mon Sep 17 00:00:00 2001 From: Douglas Cardoso <29078346+douglasdcm@users.noreply.github.com> Date: Sun, 2 Feb 2025 01:47:51 -0300 Subject: [PATCH 2/5] test --- docs/CONTRIBUTING.md | 8 ++++++++ examples/web_ui/selenium/advanced/test_external_page.py | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index d756f38..9ee9962 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -9,6 +9,14 @@ pip install -r requirements.txt -r test-requirements.txt Fork this repository, make the changes into the forked repository and push a new Merge Request to 'main' branch. Open an issue in case of big MRs. +## Install pre-commit + +It formats the code on each commit. + +``` +pre-commit install +``` + ## Testing ``` diff --git a/examples/web_ui/selenium/advanced/test_external_page.py b/examples/web_ui/selenium/advanced/test_external_page.py index 342a019..db443f6 100644 --- a/examples/web_ui/selenium/advanced/test_external_page.py +++ b/examples/web_ui/selenium/advanced/test_external_page.py @@ -47,9 +47,7 @@ def test_vpm_transaction_chain(self): home.DoRestrictedSearch, text=text, wait_for=restricted_similariy ).asserts(it.IsEqualTo, restricted_similariy) self._app.at(home.NavigateTo).asserts(it.IsEqualTo, content_in_english) - self._app.at( - home.DoExpandedSearch, text=text, wait_for=expanded_similarity - ).asserts(it.IsEqualTo, expanded_similarity) + self._app.at(home.DoExpandedSearch, text=text, wait_for=expanded_similarity).asserts(it.IsEqualTo, expanded_similarity) self._app.at(home.NavigateTo).asserts(it.IsEqualTo, content_in_english) From 5ce28070d2a3a71e556173f39b0aa3277d578f0f Mon Sep 17 00:00:00 2001 From: Douglas Cardoso <29078346+douglasdcm@users.noreply.github.com> Date: Sun, 2 Feb 2025 01:48:22 -0300 Subject: [PATCH 3/5] Add black workflow --- .github/workflows/black.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/black.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..b2cd244 --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,10 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable \ No newline at end of file From 981c9f29ffd6baa2ae2cf35acd287ddf7b376858 Mon Sep 17 00:00:00 2001 From: Douglas Cardoso <29078346+douglasdcm@users.noreply.github.com> Date: Sun, 2 Feb 2025 01:55:25 -0300 Subject: [PATCH 4/5] Formatting the entire code --- .../mobile/appium/test_appium_integration.py | 4 +--- examples/prototyping/todo/main.py | 4 +--- examples/unit_test/async_todo_list/async_todo.py | 1 + examples/unit_test/async_todo_list/operations.py | 6 ++++++ .../unit_test/async_todo_list/test_async_todo.py | 16 ++++------------ .../browserist/test_browserist_integration.py | 4 +--- .../web_ui/helium/test_helium_integration.py | 4 +--- examples/web_ui/playwright/test_web_page.py | 4 +--- examples/web_ui/selenium/advanced/home.py | 4 +--- .../selenium/advanced/test_external_page.py | 14 +++++++------- .../simple/local_page/test_local_page.py | 4 +--- .../web_ui/splinter/test_splinter_integration.py | 4 +--- guara/abstract_transaction.py | 2 ++ guara/assertion.py | 1 + guara/asynchronous/abstract_transaction.py | 2 ++ guara/asynchronous/it.py | 5 +++++ guara/asynchronous/setup.py | 3 ++- guara/asynchronous/transaction.py | 16 +++------------- guara/it.py | 4 +--- guara/setup.py | 4 +--- guara/transaction.py | 4 +--- guara/utils.py | 1 + tests/performance/async_test/app/app.py | 10 ++-------- tests/performance/async_test/test_script_1.py | 4 +--- tests/performance/sync_test/script_2.py | 4 +--- tests/performance/sync_test/test_script_1.py | 4 +--- 26 files changed, 50 insertions(+), 83 deletions(-) diff --git a/examples/mobile/appium/test_appium_integration.py b/examples/mobile/appium/test_appium_integration.py index e5ad844..7295948 100644 --- a/examples/mobile/appium/test_appium_integration.py +++ b/examples/mobile/appium/test_appium_integration.py @@ -34,7 +34,5 @@ def teardown_method(self, method): def test_local_page(self): text = ["cheese", "appium", "test", "bla", "foo"] text = text[randrange(len(text))] - self._app.at(SubmitTextAppium, text=text).asserts( - it.IsEqualTo, f"It works! {text}!" - ) + self._app.at(SubmitTextAppium, text=text).asserts(it.IsEqualTo, f"It works! {text}!") self._app.at(SubmitTextAppium, text=text).asserts(it.IsNotEqualTo, "Any") diff --git a/examples/prototyping/todo/main.py b/examples/prototyping/todo/main.py index fa48ae5..07cd6c2 100644 --- a/examples/prototyping/todo/main.py +++ b/examples/prototyping/todo/main.py @@ -40,6 +40,4 @@ def get_task(event): index = 0 index = int(index) # index = int(value) - 1 - document.querySelector("#output").innerText = app.at( - transactions.GetBy, index=index - ).result + document.querySelector("#output").innerText = app.at(transactions.GetBy, index=index).result diff --git a/examples/unit_test/async_todo_list/async_todo.py b/examples/unit_test/async_todo_list/async_todo.py index 88efa86..7510bc3 100644 --- a/examples/unit_test/async_todo_list/async_todo.py +++ b/examples/unit_test/async_todo_list/async_todo.py @@ -2,6 +2,7 @@ The module that will have the class where the tasks will be stored. """ + from typing import List, Dict diff --git a/examples/unit_test/async_todo_list/operations.py b/examples/unit_test/async_todo_list/operations.py index 06efdee..d082702 100644 --- a/examples/unit_test/async_todo_list/operations.py +++ b/examples/unit_test/async_todo_list/operations.py @@ -2,6 +2,7 @@ The module that have all of the transactions needed for the To-Do List. """ + from guara.asynchronous.transaction import AbstractTransaction from examples.unit_test.async_todo_list.async_todo import AsyncToDo from typing import Any, List, Dict @@ -11,6 +12,7 @@ class Add(AbstractTransaction): """ The addition transaction """ + def __init__(self, driver: Any): """ Initializing the transaction. @@ -29,6 +31,7 @@ class Remove(AbstractTransaction): """ The removal transaction. """ + def __init__(self, driver: Any): """ Initializing the transaction. @@ -47,6 +50,7 @@ class ListTasks(AbstractTransaction): """ The listing transaction """ + def __init__(self, driver: Any): """ Initializing the transaction. @@ -65,6 +69,7 @@ class PrintDict(AbstractTransaction): """ The array to object conversion transaction. """ + def __init__(self, driver: Any): """ Initializing the transaction. @@ -83,6 +88,7 @@ class GetBy(AbstractTransaction): """ The transaction which will get a specific task by its index. """ + def __init__(self, driver: Any): """ Initializing the transaction. diff --git a/examples/unit_test/async_todo_list/test_async_todo.py b/examples/unit_test/async_todo_list/test_async_todo.py index 1c90122..54a38b5 100644 --- a/examples/unit_test/async_todo_list/test_async_todo.py +++ b/examples/unit_test/async_todo_list/test_async_todo.py @@ -40,14 +40,10 @@ async def test_async_add_task(self, setup_test: Coroutine[Any, Any, None]) -> No """ task: str = "buy cheese" expected: List[str] = [task] - await self._todo.at(transaction=Add, task=task).asserts( - IsEqualTo, expected - ).perform() + await self._todo.at(transaction=Add, task=task).asserts(IsEqualTo, expected).perform() @mark.asyncio - async def test_async_remove_task( - self, setup_test: Coroutine[Any, Any, None] - ) -> None: + async def test_async_remove_task(self, setup_test: Coroutine[Any, Any, None]) -> None: """ Testing the remove task transaction. @@ -60,14 +56,10 @@ async def test_async_remove_task( task: str = "buy cheese" expected: List[str] = [] await self._todo.at(transaction=Add, task=task).perform() - await self._todo.at(transaction=Remove, task=task).asserts( - IsEqualTo, expected - ).perform() + await self._todo.at(transaction=Remove, task=task).asserts(IsEqualTo, expected).perform() @mark.asyncio - async def test_async_list_tasks( - self, setup_test: Coroutine[Any, Any, None] - ) -> None: + async def test_async_list_tasks(self, setup_test: Coroutine[Any, Any, None]) -> None: """ Testing the listing of the tasks transaction. diff --git a/examples/web_ui/browserist/test_browserist_integration.py b/examples/web_ui/browserist/test_browserist_integration.py index 017c32e..80bdac2 100644 --- a/examples/web_ui/browserist/test_browserist_integration.py +++ b/examples/web_ui/browserist/test_browserist_integration.py @@ -26,7 +26,5 @@ def teardown_method(self, method): def test_local_page(self): text = ["cheese", "selenium", "test", "bla", "foo"] text = text[randrange(len(text))] - self._app.at(home.SubmitText, text=text).asserts( - it.IsEqualTo, f"It works! {text}!" - ) + self._app.at(home.SubmitText, text=text).asserts(it.IsEqualTo, f"It works! {text}!") self._app.at(home.SubmitText, text=text).asserts(it.IsNotEqualTo, "Any") diff --git a/examples/web_ui/helium/test_helium_integration.py b/examples/web_ui/helium/test_helium_integration.py index 9f9f561..5488350 100644 --- a/examples/web_ui/helium/test_helium_integration.py +++ b/examples/web_ui/helium/test_helium_integration.py @@ -22,7 +22,5 @@ def teardown_method(self, method): def test_local_page(self): text = ["cheese", "selenium", "test", "bla", "foo"] text = text[randrange(len(text))] - self._app.at(home.SubmitText, text=text).asserts( - it.IsEqualTo, f"It works! {text}!" - ) + self._app.at(home.SubmitText, text=text).asserts(it.IsEqualTo, f"It works! {text}!") self._app.at(home.SubmitText, text=text).asserts(it.IsNotEqualTo, "Any") diff --git a/examples/web_ui/playwright/test_web_page.py b/examples/web_ui/playwright/test_web_page.py index 60e22a5..10e41c8 100644 --- a/examples/web_ui/playwright/test_web_page.py +++ b/examples/web_ui/playwright/test_web_page.py @@ -22,6 +22,4 @@ def setup_method(page: Page): def test_local_page_playwright(setup_method): dev_page: Application = setup_method dev_page.at(home.NavigateToGettingStarted).asserts(it.IsEqualTo, "Installation") - dev_page.at(getting_started.NavigateToWritingTests).asserts( - it.IsNotEqualTo, "Writing Tests" - ) + dev_page.at(getting_started.NavigateToWritingTests).asserts(it.IsNotEqualTo, "Writing Tests") diff --git a/examples/web_ui/selenium/advanced/home.py b/examples/web_ui/selenium/advanced/home.py index 03ffd91..8347265 100644 --- a/examples/web_ui/selenium/advanced/home.py +++ b/examples/web_ui/selenium/advanced/home.py @@ -86,9 +86,7 @@ def wait_search(self, wait_for): wait_for, ) ) - return self._driver.find_element( - By.CSS_SELECTOR, ".row:nth-child(1) > .col-md-2 > p" - ).text + return self._driver.find_element(By.CSS_SELECTOR, ".row:nth-child(1) > .col-md-2 > p").text def do(self, text, wait_for): self.fill_text(text) diff --git a/examples/web_ui/selenium/advanced/test_external_page.py b/examples/web_ui/selenium/advanced/test_external_page.py index db443f6..d5f5904 100644 --- a/examples/web_ui/selenium/advanced/test_external_page.py +++ b/examples/web_ui/selenium/advanced/test_external_page.py @@ -25,9 +25,7 @@ def test_vpm_transaction_chain(self): content_in_english = "Content of curriculum" content_in_portuguese = "Conteúdo do currículo" - self._app.at(home.ChangeToPortuguese).asserts( - it.IsEqualTo, content_in_portuguese - ) + self._app.at(home.ChangeToPortuguese).asserts(it.IsEqualTo, content_in_portuguese) # uses native assertion result = self._app.at(home.ChangeToEnglish).result it.IsEqualTo().asserts(result, content_in_english) @@ -43,11 +41,13 @@ def test_vpm_transaction_chain(self): it.IsEqualTo, "Contact us. We would be happy to answer your questions." ) self._app.at(home.NavigateTo).asserts(it.IsEqualTo, content_in_english) - self._app.at( - home.DoRestrictedSearch, text=text, wait_for=restricted_similariy - ).asserts(it.IsEqualTo, restricted_similariy) + self._app.at(home.DoRestrictedSearch, text=text, wait_for=restricted_similariy).asserts( + it.IsEqualTo, restricted_similariy + ) self._app.at(home.NavigateTo).asserts(it.IsEqualTo, content_in_english) - self._app.at(home.DoExpandedSearch, text=text, wait_for=expanded_similarity).asserts(it.IsEqualTo, expanded_similarity) + self._app.at(home.DoExpandedSearch, text=text, wait_for=expanded_similarity).asserts( + it.IsEqualTo, expanded_similarity + ) self._app.at(home.NavigateTo).asserts(it.IsEqualTo, content_in_english) diff --git a/examples/web_ui/selenium/simple/local_page/test_local_page.py b/examples/web_ui/selenium/simple/local_page/test_local_page.py index 6065ec2..49be55a 100644 --- a/examples/web_ui/selenium/simple/local_page/test_local_page.py +++ b/examples/web_ui/selenium/simple/local_page/test_local_page.py @@ -27,7 +27,5 @@ def teardown_method(self, method): def test_local_page(self): text = ["cheese", "selenium", "test", "bla", "foo"] text = text[randrange(len(text))] - self._app.at(home.SubmitText, text=text).asserts( - it.IsEqualTo, f"It works! {text}!" - ) + self._app.at(home.SubmitText, text=text).asserts(it.IsEqualTo, f"It works! {text}!") self._app.at(home.SubmitText, text=text).asserts(it.IsNotEqualTo, "Any") diff --git a/examples/web_ui/splinter/test_splinter_integration.py b/examples/web_ui/splinter/test_splinter_integration.py index 0941d83..8390751 100644 --- a/examples/web_ui/splinter/test_splinter_integration.py +++ b/examples/web_ui/splinter/test_splinter_integration.py @@ -25,7 +25,5 @@ def teardown_method(self, method): def test_local_page(self): text = ["cheese", "splinter", "test", "bla", "foo"] text = text[random.randrange(len(text))] - self._app.at(home.SubmitTextSplinter, text=text).asserts( - it.IsEqualTo, f"It works! {text}!" - ) + self._app.at(home.SubmitTextSplinter, text=text).asserts(it.IsEqualTo, f"It works! {text}!") self._app.at(home.SubmitTextSplinter, text=text).asserts(it.IsNotEqualTo, "Any") diff --git a/guara/abstract_transaction.py b/guara/abstract_transaction.py index 9e857dc..560c91d 100644 --- a/guara/abstract_transaction.py +++ b/guara/abstract_transaction.py @@ -2,6 +2,7 @@ It is the module where the AbstractTransaction will handle web transactions in an automated browser. """ + from typing import Any, NoReturn, Union, Dict @@ -9,6 +10,7 @@ class AbstractTransaction: """ It will handle web transactions in an automated browser. """ + def __init__(self, driver: Any): """ Initializing the transaction which will allow it to interact diff --git a/guara/assertion.py b/guara/assertion.py index db1077c..47966b6 100644 --- a/guara/assertion.py +++ b/guara/assertion.py @@ -2,6 +2,7 @@ The module that has the interface for the implmentation of the assertion logic to be used for validation and testing. """ + from typing import Any from logging import getLogger, Logger diff --git a/guara/asynchronous/abstract_transaction.py b/guara/asynchronous/abstract_transaction.py index 222556c..a7312cd 100644 --- a/guara/asynchronous/abstract_transaction.py +++ b/guara/asynchronous/abstract_transaction.py @@ -2,6 +2,7 @@ It is the module where the interface of the transaction will handle web transactions in an automated browser. """ + from typing import Any, NoReturn, Union, Dict @@ -9,6 +10,7 @@ class AbstractTransaction: """ It will handle web transactions in an automated browser. """ + @property def __name__(self) -> property: """ diff --git a/guara/asynchronous/it.py b/guara/asynchronous/it.py index ec9818e..f8ed508 100644 --- a/guara/asynchronous/it.py +++ b/guara/asynchronous/it.py @@ -2,6 +2,7 @@ The module that deals with the assertion and validation of a transaction at the runtime. """ + from typing import Any from guara.asynchronous.assertion import IAssertion from logging import getLogger, Logger @@ -14,6 +15,7 @@ class IsEqualTo(IAssertion): """ Equality Assertion class """ + async def asserts(self, actual: Any, expected: Any) -> None: assert actual.result == expected @@ -22,6 +24,7 @@ class IsNotEqualTo(IAssertion): """ Not Equality Assertion class """ + async def asserts(self, actual: Any, expected: Any) -> None: assert actual.result != expected @@ -30,6 +33,7 @@ class Contains(IAssertion): """ Containing Assertion class """ + async def asserts(self, actual: Any, expected: Any) -> None: assert expected in actual.result @@ -38,5 +42,6 @@ class DoesNotContain(IAssertion): """ Not Containing Assertion class """ + async def asserts(self, actual: Any, expected: Any) -> None: assert expected not in actual.result diff --git a/guara/asynchronous/setup.py b/guara/asynchronous/setup.py index dbfb906..e58c961 100644 --- a/guara/asynchronous/setup.py +++ b/guara/asynchronous/setup.py @@ -2,6 +2,7 @@ The module that is reponsible for the opening and closing transactions. """ + from guara.asynchronous.transaction import AbstractTransaction from typing import Dict, Any @@ -45,7 +46,7 @@ class CloseApp(AbstractTransaction): https://github.com/douglasdcm/caqui """ - def __init__(self, driver: (Any)): + def __init__(self, driver: Any): """ Initializing the transaction diff --git a/guara/asynchronous/transaction.py b/guara/asynchronous/transaction.py index 03119c3..4221111 100644 --- a/guara/asynchronous/transaction.py +++ b/guara/asynchronous/transaction.py @@ -72,11 +72,7 @@ def result(self) -> Any: """ return self._result - def at( - self, - transaction: AbstractTransaction, - **kwargs: Dict[str, Any] - ) -> "Application": + def at(self, transaction: AbstractTransaction, **kwargs: Dict[str, Any]) -> "Application": """ Executing each transaction. @@ -120,11 +116,7 @@ async def perform(self) -> "Application": (Application) """ for index in range(0, len(self._coroutines), 1): - ( - await self.get_assertion(index) - if not await self.get_transaction(index) - else None - ) + (await self.get_assertion(index) if not await self.get_transaction(index) else None) self._coroutines.clear() return self @@ -138,9 +130,7 @@ async def get_transaction(self, index: int) -> bool: Returns: (bool) """ - transaction: Coroutine[None, None, Any] = self._coroutines[index].get( - self._TRANSACTION - ) + transaction: Coroutine[None, None, Any] = self._coroutines[index].get(self._TRANSACTION) if transaction: LOGGER.info(f"Transaction: {self._transaction_name}") for key, value in self._kwargs.items(): diff --git a/guara/it.py b/guara/it.py index 51341f7..304f9a8 100644 --- a/guara/it.py +++ b/guara/it.py @@ -78,9 +78,7 @@ class MatchesRegex(IAssertion): def asserts(self, actual: str, expected: str) -> None: if match(expected, actual): return - raise AssertionError( - "The actual data does not match the expected regular expression." - ) + raise AssertionError("The actual data does not match the expected regular expression.") class HasSubset(IAssertion): diff --git a/guara/setup.py b/guara/setup.py index 89bc3ae..1b72292 100644 --- a/guara/setup.py +++ b/guara/setup.py @@ -64,7 +64,5 @@ def __init__(self, driver: Any): super().__init__(driver) def do(self, screenshot_filename: str = "./captures/guara-capture") -> None: - self._driver.get_screenshot_as_file( - f"{screenshot_filename}-{datetime.now()}.png" - ) + self._driver.get_screenshot_as_file(f"{screenshot_filename}-{datetime.now()}.png") self._driver.quit() diff --git a/guara/transaction.py b/guara/transaction.py index 6fc02c5..6592c8e 100644 --- a/guara/transaction.py +++ b/guara/transaction.py @@ -49,9 +49,7 @@ def result(self) -> Any: """ return self._result - def at( - self, transaction: AbstractTransaction, **kwargs: Dict[str, Any] - ) -> "Application": + def at(self, transaction: AbstractTransaction, **kwargs: Dict[str, Any]) -> "Application": """ Performing a transaction. diff --git a/guara/utils.py b/guara/utils.py index 3eb66b9..3e20a34 100644 --- a/guara/utils.py +++ b/guara/utils.py @@ -2,6 +2,7 @@ The module to be used to retrieve the information of the transaction. """ + from typing import Any diff --git a/tests/performance/async_test/app/app.py b/tests/performance/async_test/app/app.py index 2e98f9f..f2ede4b 100644 --- a/tests/performance/async_test/app/app.py +++ b/tests/performance/async_test/app/app.py @@ -12,17 +12,11 @@ async def run(self): task_1 = "buy banana" task_2 = "buy apple" task_3 = "buy orange" - await self._todo.at(transactions.Add, task=task_1).asserts( - it.IsEqualTo, [task_1] - ).perform() + await self._todo.at(transactions.Add, task=task_1).asserts(it.IsEqualTo, [task_1]).perform() await self._todo.at(transactions.Add, task=task_2).perform() await self._todo.at(transactions.Add, task=task_3).perform() - ( - await self._todo.at(transactions.ListTasks) - .asserts(it.Contains, task_1) - .perform() - ) + (await self._todo.at(transactions.ListTasks).asserts(it.Contains, task_1).perform()) await self._todo.at(transactions.Remove, task=task_1).perform() await self._todo.at(transactions.Remove, task=task_2).perform() diff --git a/tests/performance/async_test/test_script_1.py b/tests/performance/async_test/test_script_1.py index d6e4155..fff43e3 100644 --- a/tests/performance/async_test/test_script_1.py +++ b/tests/performance/async_test/test_script_1.py @@ -25,9 +25,7 @@ async def test_performance_async(): SECONDS = 60 * 5 s = time.time() - csv_writer = ( - f"./data/script_1_async_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}.csv" - ) + csv_writer = f"./data/script_1_async_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}.csv" with open(csv_writer, mode="w", newline="") as f: f.write("time,latency,cpu,mem,disk\n") while time.time() - s < SECONDS: diff --git a/tests/performance/sync_test/script_2.py b/tests/performance/sync_test/script_2.py index d7008d9..612eeca 100644 --- a/tests/performance/sync_test/script_2.py +++ b/tests/performance/sync_test/script_2.py @@ -55,9 +55,7 @@ def run_test_script() -> None: (None) """ try: - process = run( - ["python", "tests/performance/script_2_initializer.py"], check=True - ) + process = run(["python", "tests/performance/script_2_initializer.py"], check=True) return process.returncode except CalledProcessError as error: LOGGER.error(f"Error occurred while running the test script.\nError: {error}") diff --git a/tests/performance/sync_test/test_script_1.py b/tests/performance/sync_test/test_script_1.py index 13e9b03..d343430 100644 --- a/tests/performance/sync_test/test_script_1.py +++ b/tests/performance/sync_test/test_script_1.py @@ -23,9 +23,7 @@ def test_performance_sync(): SECONDS = 60 * 5 s = time.time() - csv_writer = ( - f"./data/script_1_sync_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}.csv" - ) + csv_writer = f"./data/script_1_sync_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}.csv" with open(csv_writer, mode="w", newline="") as f: f.write("time,latency,cpu,mem,disk\n") while time.time() - s < SECONDS: From fad2df03f6fd3c36f99d7c9c57ef9834d47ee51a Mon Sep 17 00:00:00 2001 From: Douglas Cardoso <29078346+douglasdcm@users.noreply.github.com> Date: Sun, 2 Feb 2025 01:57:25 -0300 Subject: [PATCH 5/5] Set line length --- .github/workflows/black.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index b2cd244..1d3eff3 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -7,4 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: psf/black@stable \ No newline at end of file + - uses: psf/black@stable + with: + options: "--check -l 100" \ No newline at end of file