Skip to content
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
13 changes: 12 additions & 1 deletion tests/agentgateway/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from dotenv import load_dotenv

from sap_cloud_sdk.agentgateway import create_client, AgentGatewayClient
from sap_cloud_sdk.agentgateway.exceptions import MCPServerNotFoundError


def _setup_cloud_mode():
Expand All @@ -23,14 +24,16 @@ def agw_client() -> AgentGatewayClient:

tenant_subdomain = os.environ.get("CLOUD_SDK_CFG_AGW_DEFAULT_TENANT_SUBDOMAIN")
if not tenant_subdomain:
pytest.fail("CLOUD_SDK_CFG_AGW_DEFAULT_TENANT_SUBDOMAIN environment variable is not set")
pytest.skip("CLOUD_SDK_CFG_AGW_DEFAULT_TENANT_SUBDOMAIN is not set — skipping AGW integration tests")

landscape = os.environ.get("CLOUD_SDK_CFG_AGW_DEFAULT_LANDSCAPE")
if landscape:
os.environ.setdefault("APPFND_CONHOS_LANDSCAPE", landscape)

try:
return create_client(tenant_subdomain=tenant_subdomain)
except MCPServerNotFoundError as e:
pytest.skip(f"AGW not subscribed for this tenant — skipping AGW integration tests: {e}")
except Exception as e:
pytest.fail(f"Failed to create Agent Gateway client for integration tests: {e}")

Expand All @@ -49,3 +52,11 @@ def pytest_collection_modifyitems(config, items):
for item in items:
if "integration" in str(item.fspath):
item.add_marker(pytest.mark.integration)


def pytest_runtest_call(item):
"""Skip AGW tests that fail due to missing subscription."""
try:
item.runtest()
except MCPServerNotFoundError as e:
pytest.skip(f"AGW not subscribed for this tenant — skipping: {e}")
30 changes: 17 additions & 13 deletions tests/dms/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from sap_cloud_sdk.dms import create_client
from sap_cloud_sdk.dms.exceptions import DMSError
from sap_cloud_sdk.dms.model import InternalRepoRequest
import pytest
import logging
Expand Down Expand Up @@ -33,22 +34,25 @@ def _setup_test_repositories(dms_client):
created_repos = []

logger.info("Onboarding test repositories")
repo = dms_client.onboard_repository(
InternalRepoRequest(
displayName=f"{_SDK_TEST_REPO_PREFIX}standard",
description="Auto-created by SDK integration tests",
try:
repo = dms_client.onboard_repository(
InternalRepoRequest(
displayName=f"{_SDK_TEST_REPO_PREFIX}standard",
description="Auto-created by SDK integration tests",
)
)
)
created_repos.append(repo.id)
created_repos.append(repo.id)

repo = dms_client.onboard_repository(
InternalRepoRequest(
displayName=f"{_SDK_TEST_REPO_PREFIX}versioned",
description="Auto-created by SDK integration tests (versioning)",
isVersionEnabled=True,
repo = dms_client.onboard_repository(
InternalRepoRequest(
displayName=f"{_SDK_TEST_REPO_PREFIX}versioned",
description="Auto-created by SDK integration tests (versioning)",
isVersionEnabled=True,
)
)
)
created_repos.append(repo.id)
created_repos.append(repo.id)
except DMSError as e:
pytest.skip(f"DMS ECM repository connection not available — skipping DMS integration tests: {e}")

yield

Expand Down
Loading