Skip to content

Commit 780ba86

Browse files
committed
rename
1 parent 0c350f9 commit 780ba86

File tree

13 files changed

+115
-95
lines changed

13 files changed

+115
-95
lines changed

packages/pytest-simcore/src/pytest_simcore/db_entries_mocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def with_product(
8282

8383

8484
@pytest.fixture
85-
async def project(
85+
async def create_project(
8686
sqlalchemy_async_engine: AsyncEngine, faker: Faker, product_name: ProductName
8787
) -> AsyncIterator[Callable[..., Awaitable[ProjectAtDB]]]:
8888
created_project_ids: list[str] = []

services/director-v2/tests/integration/01/test_computation_api.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ async def test_start_empty_computation_is_refused(
193193
async_client: httpx.AsyncClient,
194194
create_registered_user: Callable,
195195
with_product: dict[str, Any],
196-
project: Callable[..., Awaitable[ProjectAtDB]],
196+
create_project: Callable[..., Awaitable[ProjectAtDB]],
197197
osparc_product_name: str,
198198
osparc_product_api_base_url: str,
199199
create_pipeline: Callable[..., Awaitable[ComputationGet]],
200200
):
201201
user = create_registered_user()
202-
empty_project = await project(user)
202+
empty_project = await create_project(user)
203203
with pytest.raises(
204204
httpx.HTTPStatusError, match=f"{status.HTTP_422_UNPROCESSABLE_ENTITY}"
205205
):
@@ -399,7 +399,7 @@ async def test_run_partial_computation(
399399
async_client: httpx.AsyncClient,
400400
create_registered_user: Callable,
401401
with_product: dict[str, Any],
402-
project: Callable[..., Awaitable[ProjectAtDB]],
402+
create_project: Callable[..., Awaitable[ProjectAtDB]],
403403
update_project_workbench_with_comp_tasks: Callable,
404404
fake_workbench_without_outputs: dict[str, Any],
405405
params: PartialComputationParams,
@@ -409,7 +409,7 @@ async def test_run_partial_computation(
409409
):
410410
user = create_registered_user()
411411
await wait_for_catalog_service(user["id"], osparc_product_name)
412-
sleepers_project: ProjectAtDB = await project(
412+
sleepers_project: ProjectAtDB = await create_project(
413413
user, workbench=fake_workbench_without_outputs
414414
)
415415

@@ -552,7 +552,7 @@ async def test_run_computation(
552552
async_client: httpx.AsyncClient,
553553
create_registered_user: Callable,
554554
with_product: dict[str, Any],
555-
project: Callable[..., Awaitable[ProjectAtDB]],
555+
create_project: Callable[..., Awaitable[ProjectAtDB]],
556556
fake_workbench_without_outputs: dict[str, Any],
557557
update_project_workbench_with_comp_tasks: Callable,
558558
fake_workbench_computational_pipeline_details: PipelineDetails,
@@ -563,7 +563,9 @@ async def test_run_computation(
563563
):
564564
user = create_registered_user()
565565
await wait_for_catalog_service(user["id"], osparc_product_name)
566-
sleepers_project = await project(user, workbench=fake_workbench_without_outputs)
566+
sleepers_project = await create_project(
567+
user, workbench=fake_workbench_without_outputs
568+
)
567569
# send a valid project with sleepers
568570
task_out = await create_pipeline(
569571
async_client,
@@ -671,7 +673,7 @@ async def test_abort_computation(
671673
async_client: httpx.AsyncClient,
672674
create_registered_user: Callable,
673675
with_product: dict[str, Any],
674-
project: Callable[..., Awaitable[ProjectAtDB]],
676+
create_project: Callable[..., Awaitable[ProjectAtDB]],
675677
fake_workbench_without_outputs: dict[str, Any],
676678
fake_workbench_computational_pipeline_details: PipelineDetails,
677679
osparc_product_name: str,
@@ -685,7 +687,9 @@ async def test_abort_computation(
685687
node["inputs"].setdefault("in_2", 120)
686688
if not isinstance(node["inputs"]["in_2"], dict):
687689
node["inputs"]["in_2"] = 120
688-
sleepers_project = await project(user, workbench=fake_workbench_without_outputs)
690+
sleepers_project = await create_project(
691+
user, workbench=fake_workbench_without_outputs
692+
)
689693
# send a valid project with sleepers
690694
task_out = await create_pipeline(
691695
async_client,
@@ -751,7 +755,7 @@ async def test_update_and_delete_computation(
751755
async_client: httpx.AsyncClient,
752756
create_registered_user: Callable,
753757
with_product: dict[str, Any],
754-
project: Callable[..., Awaitable[ProjectAtDB]],
758+
create_project: Callable[..., Awaitable[ProjectAtDB]],
755759
fake_workbench_without_outputs: dict[str, Any],
756760
fake_workbench_computational_pipeline_details_not_started: PipelineDetails,
757761
fake_workbench_computational_pipeline_details: PipelineDetails,
@@ -760,7 +764,9 @@ async def test_update_and_delete_computation(
760764
create_pipeline: Callable[..., Awaitable[ComputationGet]],
761765
):
762766
user = create_registered_user()
763-
sleepers_project = await project(user, workbench=fake_workbench_without_outputs)
767+
sleepers_project = await create_project(
768+
user, workbench=fake_workbench_without_outputs
769+
)
764770
# send a valid project with sleepers
765771
task_out = await create_pipeline(
766772
async_client,
@@ -880,15 +886,15 @@ async def test_pipeline_with_no_computational_services_still_create_correct_comp
880886
async_client: httpx.AsyncClient,
881887
create_registered_user: Callable,
882888
with_product: dict[str, Any],
883-
project: Callable[..., Awaitable[ProjectAtDB]],
889+
create_project: Callable[..., Awaitable[ProjectAtDB]],
884890
jupyter_service: dict[str, Any],
885891
osparc_product_name: str,
886892
osparc_product_api_base_url: str,
887893
create_pipeline: Callable[..., Awaitable[ComputationGet]],
888894
):
889895
user = create_registered_user()
890896
# create a workbench with just a dynamic service
891-
project_with_dynamic_node = await project(
897+
project_with_dynamic_node = await create_project(
892898
user,
893899
workbench={
894900
"39e92f80-9286-5612-85d1-639fa47ec57d": {
@@ -927,14 +933,14 @@ async def test_pipeline_with_control_loop_made_of_dynamic_services_is_allowed(
927933
client: TestClient,
928934
create_registered_user: Callable,
929935
with_product: dict[str, Any],
930-
project: Callable[..., Awaitable[ProjectAtDB]],
936+
create_project: Callable[..., Awaitable[ProjectAtDB]],
931937
jupyter_service: dict[str, Any],
932938
osparc_product_name: str,
933939
osparc_product_api_base_url: str,
934940
):
935941
user = create_registered_user()
936942
# create a workbench with just 2 dynamic service in a cycle
937-
project_with_dynamic_node = await project(
943+
project_with_dynamic_node = await create_project(
938944
user,
939945
workbench={
940946
"39e92f80-9286-5612-85d1-639fa47ec57d": {
@@ -999,15 +1005,15 @@ async def test_pipeline_with_cycle_containing_a_computational_service_is_forbidd
9991005
client: TestClient,
10001006
create_registered_user: Callable,
10011007
with_product: dict[str, Any],
1002-
project: Callable[..., Awaitable[ProjectAtDB]],
1008+
create_project: Callable[..., Awaitable[ProjectAtDB]],
10031009
sleeper_service: dict[str, Any],
10041010
jupyter_service: dict[str, Any],
10051011
osparc_product_name: str,
10061012
osparc_product_api_base_url: str,
10071013
):
10081014
user = create_registered_user()
10091015
# create a workbench with just 2 dynamic service in a cycle
1010-
project_with_cycly_and_comp_service = await project(
1016+
project_with_cycly_and_comp_service = await create_project(
10111017
user,
10121018
workbench={
10131019
"39e92f80-9286-5612-85d1-639fa47ec57d": {
@@ -1084,7 +1090,7 @@ async def test_burst_create_computations(
10841090
async_client: httpx.AsyncClient,
10851091
create_registered_user: Callable,
10861092
with_product: dict[str, Any],
1087-
project: Callable[..., Awaitable[ProjectAtDB]],
1093+
create_project: Callable[..., Awaitable[ProjectAtDB]],
10881094
fake_workbench_without_outputs: dict[str, Any],
10891095
update_project_workbench_with_comp_tasks: Callable,
10901096
fake_workbench_computational_pipeline_details: PipelineDetails,
@@ -1094,8 +1100,12 @@ async def test_burst_create_computations(
10941100
create_pipeline: Callable[..., Awaitable[ComputationGet]],
10951101
):
10961102
user = create_registered_user()
1097-
sleepers_project = await project(user, workbench=fake_workbench_without_outputs)
1098-
sleepers_project2 = await project(user, workbench=fake_workbench_without_outputs)
1103+
sleepers_project = await create_project(
1104+
user, workbench=fake_workbench_without_outputs
1105+
)
1106+
sleepers_project2 = await create_project(
1107+
user, workbench=fake_workbench_without_outputs
1108+
)
10991109

11001110
NUMBER_OF_CALLS = 4
11011111

services/director-v2/tests/integration/02/test_dynamic_services_routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ def user_id(user_db: dict[str, Any]) -> UserID:
9898
@pytest.fixture
9999
async def project_id(
100100
user_db: dict[str, Any],
101-
project: Callable[..., Awaitable[ProjectAtDB]],
101+
create_project: Callable[..., Awaitable[ProjectAtDB]],
102102
with_product: dict[str, Any],
103103
) -> str:
104-
prj = await project(user=user_db)
104+
prj = await create_project(user=user_db)
105105
return f"{prj.uuid}"
106106

107107

services/director-v2/tests/integration/02/test_dynamic_sidecar_nodeports_integration.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ class InputsOutputs(NamedTuple):
135135
DY_SERVICES_STATE_PATH: Path = Path(DY_VOLUMES) / "workdir/generated-data"
136136
DY_SERVICES_R_CLONE_DIR_NAME: str = (
137137
# pylint: disable=bad-str-strip-call
138-
str(DY_SERVICES_STATE_PATH).strip(DY_VOLUMES).replace("/", "_")
138+
str(DY_SERVICES_STATE_PATH)
139+
.strip(DY_VOLUMES)
140+
.replace("/", "_")
139141
)
140142
TIMEOUT_DETECT_DYNAMIC_SERVICES_STOPPED = 60
141143
TIMEOUT_OUTPUTS_UPLOAD_FINISH_DETECTED = 60
@@ -260,7 +262,7 @@ def current_user(create_registered_user: Callable) -> dict[str, Any]:
260262
@pytest.fixture
261263
async def current_study(
262264
current_user: dict[str, Any],
263-
project: Callable[..., Awaitable[ProjectAtDB]],
265+
create_project: Callable[..., Awaitable[ProjectAtDB]],
264266
fake_dy_workbench: dict[str, Any],
265267
sleeper_service: dict,
266268
dy_static_file_server_dynamic_sidecar_service: dict,
@@ -298,7 +300,7 @@ async def current_study(
298300
)
299301

300302
# create project for this user
301-
project_at_db = await project(current_user, workbench=fake_dy_workbench)
303+
project_at_db = await create_project(current_user, workbench=fake_dy_workbench)
302304

303305
# create entries in comp_task table in order to pull output ports
304306
await create_pipeline(
@@ -639,19 +641,19 @@ async def _container_id_via_services(service_uuid: str) -> str:
639641
if service["Spec"]["Name"] == service_name:
640642
service_id = service["ID"]
641643
break
642-
assert service_id is not None, (
643-
f"No service found for service name: {service_name}"
644-
)
644+
assert (
645+
service_id is not None
646+
), f"No service found for service name: {service_name}"
645647

646648
for task in await docker_client.tasks.list():
647649
if task["ServiceID"] == service_id:
648650
assert task["Status"]["State"] == "running"
649651
container_id = task["Status"]["ContainerStatus"]["ContainerID"]
650652
break
651653

652-
assert container_id is not None, (
653-
f"No container found for service name {service_name}"
654-
)
654+
assert (
655+
container_id is not None
656+
), f"No container found for service name {service_name}"
655657

656658
return container_id
657659

@@ -912,9 +914,9 @@ async def _assert_retrieve_completed(
912914
container.log(stdout=True, stderr=True),
913915
)
914916
)
915-
assert _CONTROL_TESTMARK_DY_SIDECAR_NODEPORT_UPLOADED_MESSAGE in logs, (
916-
"TIP: Message missing suggests that the data was never uploaded: look in services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/nodeports.py"
917-
)
917+
assert (
918+
_CONTROL_TESTMARK_DY_SIDECAR_NODEPORT_UPLOADED_MESSAGE in logs
919+
), "TIP: Message missing suggests that the data was never uploaded: look in services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/nodeports.py"
918920

919921

920922
def product_name(osparc_product_name: ProductName) -> ProductName:
@@ -976,16 +978,16 @@ async def test_nodeports_integration(
976978
`aioboto` instead of `docker` or `storage-data_manager API`.
977979
"""
978980
# STEP 1
979-
dynamic_services_urls: dict[
980-
str, str
981-
] = await _start_and_wait_for_dynamic_services_ready(
982-
director_v2_client=async_client,
983-
product_name=osparc_product_name,
984-
product_api_base_url=osparc_product_api_base_url,
985-
user_id=current_user["id"],
986-
workbench_dynamic_services=workbench_dynamic_services,
987-
current_study=current_study,
988-
catalog_url=services_endpoint["catalog"],
981+
dynamic_services_urls: dict[str, str] = (
982+
await _start_and_wait_for_dynamic_services_ready(
983+
director_v2_client=async_client,
984+
product_name=osparc_product_name,
985+
product_api_base_url=osparc_product_api_base_url,
986+
user_id=current_user["id"],
987+
workbench_dynamic_services=workbench_dynamic_services,
988+
current_study=current_study,
989+
catalog_url=services_endpoint["catalog"],
990+
)
989991
)
990992

991993
# STEP 2

services/director-v2/tests/integration/02/test_mixed_dynamic_sidecar_and_legacy_project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ async def dy_static_file_server_project(
140140
minimal_configuration: None,
141141
user_dict: dict[str, Any],
142142
with_product: dict[str, Any],
143-
project: Callable[..., Awaitable[ProjectAtDB]],
143+
create_project: Callable[..., Awaitable[ProjectAtDB]],
144144
dy_static_file_server_service: dict,
145145
dy_static_file_server_dynamic_sidecar_service: dict,
146146
dy_static_file_server_dynamic_sidecar_compose_spec_service: dict,
@@ -155,7 +155,7 @@ def _assemble_node_data(spec: dict, label: str) -> dict[str, str]:
155155
"label": label,
156156
}
157157

158-
return await project(
158+
return await create_project(
159159
user=user_dict,
160160
workbench={
161161
uuid_legacy: _assemble_node_data(

0 commit comments

Comments
 (0)