From 42aac36360a1d4fedb9ca31080199bbf30b82de9 Mon Sep 17 00:00:00 2001 From: AlexNg Date: Sun, 28 Apr 2024 14:41:33 +0800 Subject: [PATCH 1/3] test: Remove src import Reverting the revert of #59 Ref: #59 Ref: #61 Co-authored-by: Rob van der Linde --- tests/__init__.py | 1 - tests/conftest.py | 2 +- tests/test_algorithm.py | 2 +- tests/test_concurrentprocessing.py | 2 +- tests/test_dataframe_compatibility.py | 8 +++----- tests/test_decorator.py | 2 +- tests/test_thread.py | 2 +- tests/test_verbosity.py | 2 +- 8 files changed, 9 insertions(+), 12 deletions(-) delete mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index 7f4e92b..0000000 --- a/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Need this file, else it can't import src.thread diff --git a/tests/conftest.py b/tests/conftest.py index 76fc82d..6870223 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,3 @@ -from src.thread import Settings +from thread import Settings Settings.set_verbosity('quiet') diff --git a/tests/test_algorithm.py b/tests/test_algorithm.py index 4d629cd..e9c6599 100644 --- a/tests/test_algorithm.py +++ b/tests/test_algorithm.py @@ -1,7 +1,7 @@ import random from typing import Generator -from src.thread.utils import algorithm +from thread.utils import algorithm def test_type(): diff --git a/tests/test_concurrentprocessing.py b/tests/test_concurrentprocessing.py index eba5ea6..ae0eac7 100644 --- a/tests/test_concurrentprocessing.py +++ b/tests/test_concurrentprocessing.py @@ -1,6 +1,6 @@ import time import pytest -from src.thread import ConcurrentProcessing, exceptions +from thread import ConcurrentProcessing, exceptions # >>>>>>>>>> Dummy Functions <<<<<<<<<< # diff --git a/tests/test_dataframe_compatibility.py b/tests/test_dataframe_compatibility.py index 80406c3..c79857b 100644 --- a/tests/test_dataframe_compatibility.py +++ b/tests/test_dataframe_compatibility.py @@ -1,6 +1,6 @@ import typing import pytest -from src.thread import ConcurrentProcessing +from thread import ConcurrentProcessing class DummyLengthOnly: @@ -33,13 +33,11 @@ def __init__(self, length: typing.Any, dataset: list): class DummyUnlikeSequence1: - def __init__(self) -> None: - ... + def __init__(self) -> None: ... class DummyUnlikeSequence2: - def __init__(self) -> None: - ... + def __init__(self) -> None: ... def __str__(self) -> str: return 'invalid' diff --git a/tests/test_decorator.py b/tests/test_decorator.py index 4b676d0..601b50d 100644 --- a/tests/test_decorator.py +++ b/tests/test_decorator.py @@ -1,5 +1,5 @@ import time -from src.thread import threaded, processor +from thread import threaded, processor # >>>>>>>>>> Dummy Functions <<<<<<<<<< # diff --git a/tests/test_thread.py b/tests/test_thread.py index af99593..7eb7d14 100644 --- a/tests/test_thread.py +++ b/tests/test_thread.py @@ -1,6 +1,6 @@ import time import pytest -from src.thread import Thread, exceptions +from thread import Thread, exceptions # >>>>>>>>>> Dummy Functions <<<<<<<<<< # diff --git a/tests/test_verbosity.py b/tests/test_verbosity.py index 60ff0ba..5d36228 100644 --- a/tests/test_verbosity.py +++ b/tests/test_verbosity.py @@ -1,5 +1,5 @@ import pytest -from src.thread.utils.config import Verbosity +from thread.utils.config import Verbosity # >>>>>>>>>> General Use <<<<<<<<<< # From c2f2214d3848cfdca6892cd44ac5f41f1f06083e Mon Sep 17 00:00:00 2001 From: AlexNg Date: Sun, 28 Apr 2024 14:43:34 +0800 Subject: [PATCH 2/3] ci(test): Run pytest through poetry Might resolve the previous unresolved ci issue in #59 --- .github/workflows/test-worker.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test-worker.yml b/.github/workflows/test-worker.yml index 231a2ef..ea91358 100644 --- a/.github/workflows/test-worker.yml +++ b/.github/workflows/test-worker.yml @@ -51,14 +51,11 @@ jobs: set -xe python -m pip install poetry coverage pytest python -m poetry install - python -m poetry self add poetry-plugin-export - python -m poetry export -f requirements.txt --output requirements.txt - python -m pip install -r requirements.txt - name: Test with pytest run: | set -xe - python -m pytest -sv + python -m poetry run pytest -sv check: if: always() From 2d963fd4fb833dee1ab5b65f65d56a5eda17f8ff Mon Sep 17 00:00:00 2001 From: AlexNg Date: Sun, 28 Apr 2024 14:47:11 +0800 Subject: [PATCH 3/3] style: Conform to linting --- tests/test_dataframe_compatibility.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_dataframe_compatibility.py b/tests/test_dataframe_compatibility.py index c79857b..a539507 100644 --- a/tests/test_dataframe_compatibility.py +++ b/tests/test_dataframe_compatibility.py @@ -33,11 +33,13 @@ def __init__(self, length: typing.Any, dataset: list): class DummyUnlikeSequence1: - def __init__(self) -> None: ... + def __init__(self) -> None: + ... class DummyUnlikeSequence2: - def __init__(self) -> None: ... + def __init__(self) -> None: + ... def __str__(self) -> str: return 'invalid'