Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid import sorting in tests #62

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
dependencies = [
"black>=23.1.0",
"mypy>=1.0.0",
"ruff>=0.0.243",
"ruff>=0.4.0",
"numpy>=1.20",
"asyncio-atexit==1.0.1",
]
Expand All @@ -98,7 +98,10 @@ all = ["style", "typing"]
target-version = ["py38"]

[tool.ruff]
src = ["src", "tests"]
target-version = "py38"

[tool.ruff.lint]
select = ["ALL"]
ignore = [
# Type annotation for self
Expand All @@ -119,23 +122,23 @@ ignore = [
"ANN204",
]

[tool.ruff.flake8-annotations]
[tool.ruff.lint.flake8-annotations]
mypy-init-return = true

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds 15.
max-complexity = 15

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-third-party = ["capnp"]

[tool.ruff.flake8-tidy-imports]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = [
"PLR2004",
Expand Down
3 changes: 2 additions & 1 deletion tests/core/test_annotated_value_from_capnp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from unittest.mock import patch

import labone.core.value as value_module
import numpy as np
import pytest

import labone.core.value as value_module
from labone.core.errors import LabOneCoreError

from .resources import value_capnp
Expand Down
1 change: 1 addition & 0 deletions tests/core/test_annotated_value_to_capnp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from hypothesis import HealthCheck, given, settings
from hypothesis import strategies as st
from hypothesis.extra.numpy import arrays

from labone.core.helper import VectorElementType
from labone.core.shf_vector_data import (
VectorValueType,
Expand Down
3 changes: 2 additions & 1 deletion tests/core/test_connection_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from unittest.mock import patch

import pytest
from labone.core import connection_layer, errors
from packaging import version

from labone.core import connection_layer, errors

from .resources import hello_msg_capnp, orchestrator_capnp


Expand Down
1 change: 1 addition & 0 deletions tests/core/test_create_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from unittest.mock import AsyncMock, MagicMock, patch

import pytest

from labone.core import connection_layer, kernel_session
from labone.core.errors import LabOneCoreError, UnavailableError

Expand Down
3 changes: 2 additions & 1 deletion tests/core/test_kj_event_loop.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import asyncio
from unittest.mock import patch

import labone.core.helper
import pytest
import pytest_asyncio

import labone.core.helper


@pytest_asyncio.fixture(autouse=True)
async def kj_loop():
Expand Down
3 changes: 2 additions & 1 deletion tests/core/test_reflection_server.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch

import capnp
import labone.core.reflection.server as reflection_server
import pytest

import labone.core.reflection.server as reflection_server
from labone.core.errors import LabOneCoreError


Expand Down
1 change: 1 addition & 0 deletions tests/core/test_reflection_type_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
_InterfaceModule,
_StructModule,
)

from labone.core.reflection import capnp_dynamic_type_system
from labone.core.reflection.parsed_wire_schema import LoadedNode

Expand Down
1 change: 1 addition & 0 deletions tests/core/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import capnp
import pytest

from labone.core import errors
from labone.core.result import unwrap

Expand Down
1 change: 1 addition & 0 deletions tests/core/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import capnp
import pytest
import pytest_asyncio

from labone.core import errors
from labone.core.connection_layer import ServerInfo, ZIKernelInfo
from labone.core.helper import request_field_type_description
Expand Down
1 change: 1 addition & 0 deletions tests/core/test_shf_vector_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as np
import pytest

from labone.core.shf_vector_data import (
SHFDemodSample,
ShfDemodulatorVectorExtraHeader,
Expand Down
1 change: 1 addition & 0 deletions tests/core/test_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import capnp
import pytest

from labone.core import errors
from labone.core.subscription import (
CircularDataQueue,
Expand Down
1 change: 1 addition & 0 deletions tests/mock/ab_hpk_automatic_functionality_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from contextlib import redirect_stdout

import pytest

from labone.core import AnnotatedValue, KernelSession, ServerInfo, ZIKernelInfo
from labone.core.session import ListNodesFlags, Session
from labone.mock import spawn_hpk_mock
Expand Down
1 change: 1 addition & 0 deletions tests/mock/module_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import numpy as np
import pytest

from labone.core import AnnotatedValue
from labone.core.shf_vector_data import (
SHFDemodSample,
Expand Down
1 change: 1 addition & 0 deletions tests/mock/test_automatic_mock_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import numpy as np
import pytest

from labone.core.errors import LabOneCoreError

if TYPE_CHECKING:
Expand Down
1 change: 1 addition & 0 deletions tests/mock/test_session_mock_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from unittest.mock import ANY, Mock

import pytest

from labone.core.session import ListNodesFlags
from labone.core.value import AnnotatedValue
from labone.mock.entry_point import spawn_hpk_mock
Expand Down
1 change: 0 additions & 1 deletion tests/nodetree/test_node_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from labone.core.value import AnnotatedValue
from labone.nodetree.enum import _get_enum
from labone.nodetree.errors import LabOneInvalidPathError

from tests.mock_server_for_testing import get_mocked_node, get_unittest_mocked_node


Expand Down
2 changes: 1 addition & 1 deletion tests/nodetree/test_node_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from __future__ import annotations

import pytest
from labone.node_info import NodeInfo, OptionInfo

from labone.node_info import NodeInfo, OptionInfo
from tests.mock_server_for_testing import get_unittest_mocked_node


Expand Down
1 change: 1 addition & 0 deletions tests/nodetree/test_node_to_session_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from unittest.mock import ANY, Mock

import pytest

from labone.core.session import Session
from labone.core.value import AnnotatedValue
from labone.nodetree.entry_point import construct_nodetree
Expand Down
2 changes: 1 addition & 1 deletion tests/nodetree/test_result_node.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from labone.core.value import AnnotatedValue
from labone.nodetree.errors import LabOneInvalidPathError

from tests.mock_server_for_testing import get_mocked_node


Expand Down
1 change: 1 addition & 0 deletions tests/nodetree/test_split_join_path.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from labone.nodetree.helper import join_path, split_path


Expand Down
1 change: 1 addition & 0 deletions tests/test_dataserver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import AsyncMock, MagicMock, patch

import pytest

from labone.core import (
KernelSession,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_instrument.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from unittest.mock import MagicMock, patch

import pytest

from labone.errors import LabOneError
from labone.instrument import Instrument
from labone.mock import AutomaticSessionFunctionality, spawn_hpk_mock

from tests.mock_server_for_testing import get_mocked_node


Expand Down
Loading