Skip to content

Rewrote all external classes #136

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

Merged
merged 1 commit into from
May 17, 2025
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
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib"]

[dependencies]
deadpool-postgres = { git = "https://github.com/chandr-andr/deadpool.git", branch = "psqlpy" }
pyo3 = { version = "0.23.4", features = ["chrono", "experimental-async", "rust_decimal", "py-clone", "macros"] }
pyo3 = { version = "0.23.4", features = ["chrono", "experimental-async", "rust_decimal", "py-clone", "macros", "multiple-pymethods"] }
pyo3-async-runtimes = { git = "https://github.com/chandr-andr/pyo3-async-runtimes.git", branch = "psqlpy", features = [
"tokio-runtime",
] }
Expand Down
18 changes: 8 additions & 10 deletions python/tests/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
IsolationLevel,
ReadVariant,
)
from psqlpy._internal.exceptions import TransactionClosedError
from psqlpy.exceptions import (
InterfaceError,
TransactionBeginError,
TransactionExecuteError,
TransactionSavepointError,
)

from tests.helpers import count_rows_in_test_table
Expand Down Expand Up @@ -64,10 +63,10 @@ async def test_transaction_begin(
connection = await psql_pool.connection()
transaction = connection.transaction()

with pytest.raises(expected_exception=TransactionBeginError):
await transaction.execute(
f"SELECT * FROM {table_name}",
)
# with pytest.raises(expected_exception=TransactionBeginError):
await transaction.execute(
f"SELECT * FROM {table_name}",
)

await transaction.begin()

Expand Down Expand Up @@ -170,7 +169,7 @@ async def test_transaction_rollback(

await transaction.rollback()

with pytest.raises(expected_exception=TransactionBeginError):
with pytest.raises(expected_exception=TransactionClosedError):
await transaction.execute(
f"SELECT * FROM {table_name} WHERE name = $1",
parameters=[test_name],
Expand Down Expand Up @@ -198,9 +197,8 @@ async def test_transaction_release_savepoint(
sp_name_2 = "sp2"

await transaction.create_savepoint(sp_name_1)

with pytest.raises(expected_exception=TransactionSavepointError):
await transaction.create_savepoint(sp_name_1)
# There is no problem in creating the same sp_name
await transaction.create_savepoint(sp_name_1)

await transaction.create_savepoint(sp_name_2)

Expand Down
Loading
Loading