Skip to content

Commit

Permalink
Run tests in isolation
Browse files Browse the repository at this point in the history
  • Loading branch information
henadzit committed Dec 2, 2024
1 parent 01d7872 commit 5ef0fbf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_transactions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from unittest.mock import Mock

from tests.testmodels import CharPkModel, Event, Team, Tournament
from tortoise import connections
from tortoise.contrib import test
Expand Down Expand Up @@ -216,6 +217,11 @@ async def test_select_await_across_transaction_success(self):
await Tournament.all().values("id", "name"), [{"id": obj.id, "name": "Test1"}]
)


@test.requireCapability(supports_transactions=True)
class TestIsolatedTransactions(test.IsolatedTestCase):
"""Running these in isolation because they mess with the global state of the connections."""

async def test_rollback_raising_exception(self):
"""Tests that if a rollback raises an exception, the connection context is restored."""
conn = connections.get("models")
Expand Down

0 comments on commit 5ef0fbf

Please sign in to comment.