Skip to content

Commit 963ac2f

Browse files
author
Вадим Козыревский
committed
Fix after pre-commit
1 parent 2738cbc commit 963ac2f

8 files changed

Lines changed: 33 additions & 37 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: check-added-large-files
1010
- args:
1111
- --pytest-test-first
12-
exclude: (^tests/mock/|^tests/integration/|^tests/fixtures)
12+
exclude: (^tests/mock/|^tests/integration/|^tests/fixtures|conftest\.py$)
1313
id: name-tests-test
1414
- id: check-merge-conflict
1515
- id: check-json

tests/benchmarks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Benchmark package; shared helpers in storage_legacy.py
1+
# Benchmark package; shared helpers in conftest.py

tests/benchmarks/conftest.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
1-
"""Shared fixtures for benchmarks. Engine and loop are session-scoped for saga SQLAlchemy benchmarks."""
1+
"""Shared fixtures and legacy storage classes for benchmarks."""
2+
3+
from __future__ import annotations
24

35
import asyncio
6+
import contextlib
47
import os
58

69
import pytest
710
from sqlalchemy.ext.asyncio import create_async_engine
811

9-
from cqrs.saga.storage.sqlalchemy import Base
12+
from cqrs.saga.storage.memory import MemorySagaStorage
13+
from cqrs.saga.storage.protocol import SagaStorageRun
14+
from cqrs.saga.storage.sqlalchemy import Base, SqlAlchemySagaStorage
15+
16+
17+
class MemorySagaStorageLegacy(MemorySagaStorage):
18+
"""Memory storage without create_run: forces legacy path (commit per call)."""
19+
20+
def create_run(
21+
self,
22+
) -> contextlib.AbstractAsyncContextManager[SagaStorageRun]:
23+
"""Raise NotImplementedError so benchmarks use the legacy commit-per-call path."""
24+
raise NotImplementedError("Legacy storage: create_run disabled for benchmark")
25+
26+
27+
class SqlAlchemySagaStorageLegacy(SqlAlchemySagaStorage):
28+
"""SQLAlchemy storage without create_run: forces legacy path (commit per call)."""
29+
30+
def create_run(
31+
self,
32+
) -> contextlib.AbstractAsyncContextManager[SagaStorageRun]:
33+
"""Raise NotImplementedError so benchmarks use the legacy commit-per-call path."""
34+
raise NotImplementedError("Legacy storage: create_run disabled for benchmark")
1035

1136

1237
@pytest.fixture(scope="session")

tests/benchmarks/dataclasses/test_benchmark_saga_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from cqrs.saga.step import SagaStepHandler, SagaStepResult
1717
from cqrs.saga.storage.memory import MemorySagaStorage
1818

19-
from ..storage_legacy import MemorySagaStorageLegacy
19+
from ..conftest import MemorySagaStorageLegacy
2020

2121

2222
@dataclasses.dataclass

tests/benchmarks/dataclasses/test_benchmark_saga_sqlalchemy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from cqrs.saga.saga import Saga
1111
from cqrs.saga.storage.sqlalchemy import SqlAlchemySagaStorage
1212

13-
from ..storage_legacy import SqlAlchemySagaStorageLegacy
13+
from ..conftest import SqlAlchemySagaStorageLegacy
1414
from .test_benchmark_saga_memory import (
1515
OrderContext,
1616
ProcessPaymentStep,

tests/benchmarks/default/test_benchmark_saga_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from cqrs.saga.step import SagaStepHandler, SagaStepResult
1717
from cqrs.saga.storage.memory import MemorySagaStorage
1818

19-
from ..storage_legacy import MemorySagaStorageLegacy
19+
from ..conftest import MemorySagaStorageLegacy
2020

2121

2222
@dataclasses.dataclass

tests/benchmarks/default/test_benchmark_saga_sqlalchemy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from cqrs.saga.saga import Saga
1111
from cqrs.saga.storage.sqlalchemy import SqlAlchemySagaStorage
1212

13-
from ..storage_legacy import SqlAlchemySagaStorageLegacy
13+
from ..conftest import SqlAlchemySagaStorageLegacy
1414
from .test_benchmark_saga_memory import (
1515
OrderContext,
1616
ProcessPaymentStep,

tests/benchmarks/storage_legacy.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)