Skip to content
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
7 changes: 5 additions & 2 deletions coilmq/subscription.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from __future__ import annotations

import itertools
from collections import defaultdict
from dataclasses import dataclass
from typing import Any
from typing import TYPE_CHECKING, Any

from coilmq.server import StompConnection
if TYPE_CHECKING:
from coilmq.server import StompConnection

DEFAULT_SUBSCRIPTION_ID = 0

Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ dependency-groups.docs = { requires-python = ">=3.13" }
[tool.ruff]
line-length = 88
preview = true
lint.extend-select = [
"TC",
]
lint.ignore = [
"DTZ001", # call-datetime-without-tzinfo
"DTZ005", # call-datetime-now-without-tzinfo
]
lint.future-annotations = true

[tool.pyproject-fmt]
indent = 4
Expand Down
8 changes: 5 additions & 3 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
from __future__ import annotations

import threading
from typing import Generator
from typing import TYPE_CHECKING, Generator

import pytest

from coilmq.auth import Authenticator
from coilmq.protocol import STOMP10
from coilmq.queue import QueueManager
from coilmq.scheduler import FavorReliableSubscriberScheduler, RandomQueueScheduler
from coilmq.server.socket_server import ThreadedStompServer
from coilmq.store import QueueStore
from coilmq.topic import TopicManager
from tests.functional import Client

if TYPE_CHECKING:
from coilmq.auth import Authenticator
from coilmq.store import QueueStore


@pytest.fixture
def server(
Expand Down
7 changes: 5 additions & 2 deletions tests/functional/test_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

import zlib
from queue import Empty
from typing import TYPE_CHECKING

import pytest

from coilmq.auth.simple import SimpleAuthenticator
from coilmq.server.socket_server import ThreadedStompServer
from coilmq.store.memory import MemoryQueue
from coilmq.util import frames
from tests.functional import Client

if TYPE_CHECKING:
from coilmq.server.socket_server import ThreadedStompServer
from tests.functional import Client

__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
__copyright__ = "Copyright 2009 Hans Lellelid"
Expand Down
6 changes: 4 additions & 2 deletions tests/protocol/conftest.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
from __future__ import annotations

from typing import Generator
from typing import TYPE_CHECKING, Generator

import pytest

from coilmq.engine import StompEngine
from coilmq.protocol import STOMP11, STOMP12
from tests.mock import (
MockConnection,
MockQueueManager,
MockTopicManager,
)

if TYPE_CHECKING:
from coilmq.protocol import STOMP11, STOMP12


@pytest.fixture
def engine(protocol: type[STOMP11 | STOMP12]) -> Generator[StompEngine, None, None]:
Expand Down
5 changes: 4 additions & 1 deletion tests/protocol/test_1_1.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from __future__ import annotations

import time
from typing import TYPE_CHECKING

import pytest

from coilmq.engine import StompEngine
from coilmq.protocol import STOMP11
from coilmq.util import frames
from coilmq.util.frames import ErrorFrame, Frame

if TYPE_CHECKING:
from coilmq.engine import StompEngine


@pytest.fixture
def protocol() -> type[STOMP11]:
Expand Down
5 changes: 4 additions & 1 deletion tests/protocol/test_stomp_1_2.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from __future__ import annotations

import socket
from typing import TYPE_CHECKING

import pytest

from coilmq.engine import StompEngine
from coilmq.protocol import STOMP11, STOMP12
from coilmq.util import frames
from coilmq.util.frames import Frame

if TYPE_CHECKING:
from coilmq.engine import StompEngine


@pytest.fixture
def protocol() -> type[STOMP12]:
Expand Down
9 changes: 7 additions & 2 deletions tests/queue_manager/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
"""Tests for queue-related classes."""

from __future__ import annotations

import re
import uuid
from typing import TYPE_CHECKING

import pytest

from coilmq.queue import QueueManager
from coilmq.store import QueueStore
from coilmq.util import frames
from coilmq.util.frames import Frame
from tests.mock import MockConnection

if TYPE_CHECKING:
from coilmq.queue import QueueManager
from coilmq.store import QueueStore

__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
__copyright__ = "Copyright 2009 Hans Lellelid"
__license__ = """Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
8 changes: 6 additions & 2 deletions tests/queue_manager/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from typing import Generator
from __future__ import annotations

from typing import TYPE_CHECKING, Generator

import pytest

from coilmq.queue import QueueManager
from coilmq.store import QueueStore
from tests.mock import MockConnection

if TYPE_CHECKING:
from coilmq.store import QueueStore


@pytest.fixture
def queue_manager(store: QueueStore) -> Generator[QueueManager, None, None]:
Expand Down
7 changes: 6 additions & 1 deletion tests/queue_manager/test_dbm.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
"""Test of the QueueManager when using a DBM backend (store)."""

from pathlib import Path
from __future__ import annotations

from typing import TYPE_CHECKING

import pytest

from coilmq.store.dbm import DbmQueue
from tests.queue_manager import QueueManagerTests

if TYPE_CHECKING:
from pathlib import Path

__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
__copyright__ = "Copyright 2009 Hans Lellelid"
__license__ = """Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
7 changes: 6 additions & 1 deletion tests/store/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
"""Queue storage tests."""

from __future__ import annotations

import uuid
from typing import TYPE_CHECKING

from coilmq.store import QueueStore
from coilmq.util import frames
from coilmq.util.frames import Frame

if TYPE_CHECKING:
from coilmq.store import QueueStore

__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
__copyright__ = "Copyright 2009 Hans Lellelid"
__license__ = """Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
11 changes: 8 additions & 3 deletions tests/store/test_dbm.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
"""Test DBM queue storage."""

from __future__ import annotations

import time
import uuid
from contextlib import closing
from pathlib import Path
from typing import Generator
from typing import TYPE_CHECKING, Generator

import pytest

from coilmq.store import QueueStore
from coilmq.store.dbm import DbmQueue
from coilmq.util import frames
from coilmq.util.frames import Frame
from tests.store import BaseQueueTests

if TYPE_CHECKING:
from pathlib import Path

from coilmq.store import QueueStore

__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
__copyright__ = "Copyright 2009 Hans Lellelid"
__license__ = """Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
8 changes: 6 additions & 2 deletions tests/store/test_sa.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
"""Test SQLAlchemy storage."""

from __future__ import annotations

import datetime
from typing import Generator
from typing import TYPE_CHECKING, Generator

import pytest
from sqlalchemy import create_engine

from coilmq.store import QueueStore
from coilmq.store.sa import SAQueue, init_model, meta, model
from coilmq.util import frames
from coilmq.util.frames import Frame
from tests.store import BaseQueueTests

if TYPE_CHECKING:
from coilmq.store import QueueStore

__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
__copyright__ = "Copyright 2009 Hans Lellelid"
__license__ = """Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
6 changes: 4 additions & 2 deletions tests/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

from __future__ import annotations

from typing import Generator
from typing import TYPE_CHECKING, Generator

import pytest

from coilmq.auth import Authenticator
from coilmq.engine import StompEngine
from coilmq.util import frames
from coilmq.util.frames import Frame, ReceiptFrame
Expand All @@ -17,6 +16,9 @@
MockTopicManager,
)

if TYPE_CHECKING:
from coilmq.auth import Authenticator

__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
__copyright__ = "Copyright 2009 Hans Lellelid"
__license__ = """Licensed under the Apache License, Version 2.0 (the "License");
Expand Down