Skip to content

Commit eabf588

Browse files
author
Andrei Neagu
committed
Merge remote-tracking branch 'upstream/pydantic_v2_migration' into pr-osparc-pydantic2-dask-sidecar2
2 parents ca74d85 + fbf9fa9 commit eabf588

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+520
-277
lines changed

packages/models-library/src/models_library/api_schemas_payments/errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from pydantic.errors import PydanticErrorMixin
1+
from common_library.errors_classes import OsparcErrorMixin
22

33

4-
class _BaseRpcApiError(PydanticErrorMixin, ValueError):
4+
class _BaseRpcApiError(OsparcErrorMixin, ValueError):
55
@classmethod
66
def get_full_class_name(cls) -> str:
77
# Can be used as unique code identifier

packages/postgres-database/tests/test_models_payments_transactions.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import decimal
88
from collections.abc import Callable
9+
from typing import Any
910

1011
import pytest
1112
import sqlalchemy as sa
@@ -43,14 +44,25 @@ async def test_numerics_precission_and_scale(connection: SAConnection):
4344
assert float(got) == expected
4445

4546

47+
def _remove_not_required(data: dict[str, Any]) -> dict[str, Any]:
48+
for to_remove in (
49+
"completed_at",
50+
"invoice_url",
51+
"invoice_pdf_url",
52+
"state",
53+
"state_message",
54+
"stripe_invoice_id",
55+
):
56+
data.pop(to_remove)
57+
return data
58+
59+
4660
@pytest.fixture
4761
def init_transaction(connection: SAConnection):
4862
async def _init(payment_id: str):
4963
# get payment_id from payment-gateway
50-
values = random_payment_transaction(payment_id=payment_id)
51-
# remove states
52-
values.pop("state")
53-
values.pop("completed_at")
64+
values = _remove_not_required(random_payment_transaction(payment_id=payment_id))
65+
5466
# init successful: set timestamp
5567
values["initiated_at"] = utcnow()
5668

@@ -180,10 +192,8 @@ def create_fake_user_transactions(connection: SAConnection, user_id: int) -> Cal
180192
async def _go(expected_total=5):
181193
payment_ids = []
182194
for _ in range(expected_total):
183-
values = random_payment_transaction(user_id=user_id)
184-
# remove states
185-
values.pop("state")
186-
values.pop("completed_at")
195+
values = _remove_not_required(random_payment_transaction(user_id=user_id))
196+
187197
payment_id = await insert_init_payment_transaction(connection, **values)
188198
assert payment_id
189199
payment_ids.append(payment_id)

packages/pytest-simcore/src/pytest_simcore/helpers/faker_factories.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ def random_payment_transaction(
301301
"initiated_at": utcnow(),
302302
"state": PaymentTransactionState.PENDING,
303303
"completed_at": None,
304+
"invoice_url": None,
305+
"stripe_invoice_id": None,
306+
"invoice_pdf_url": None,
307+
"state_message": None,
304308
}
305309
# state is not added on purpose
306310
assert set(data.keys()).issubset({c.name for c in payments_transactions.columns})

packages/settings-library/src/settings_library/utils_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def print_as_envfile(
6969
def print_as_json(
7070
settings_obj,
7171
*,
72-
compact=False,
72+
compact: bool = False,
73+
show_secrets: bool,
7374
json_serializer,
74-
show_secrets,
7575
**pydantic_export_options,
7676
):
7777
typer.echo(

0 commit comments

Comments
 (0)