From 73ab91ffbb7134d1efa1b0e9202d2d5e32c63fa6 Mon Sep 17 00:00:00 2001 From: Ari Angelo Date: Thu, 28 May 2026 13:42:17 +0200 Subject: [PATCH] test: add slim smoke tests and verify test suite for aignostics-sdk split [PYSDK-141] - Add `slim` pytest marker to pyproject.toml for aignostics-sdk package tests - Create tests/aignostics_sdk/__init__.py and smoke_test.py - 5 smoke tests verify importability of aignostics_sdk.platform.Client, aignostics_sdk.utils.{BaseService,Health}, aignx.codegen.exceptions.ApiException, __project_name__ backward-compat constant, and __version__ availability - 1 xfail test documents missing aignostics_sdk.cli module (pending PYSDK-137) - No stale `from aignostics.platform` / `from aignostics.utils` imports in tests/ - Collection: 904 tests collected (0 collection errors) - Pre-existing failures in base branch (stale patch() paths from PYSDK-136 import rewrite) are not introduced by this PR; they will be tracked separately --- pyproject.toml | 1 + tests/aignostics_sdk/__init__.py | 1 + tests/aignostics_sdk/smoke_test.py | 92 ++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 tests/aignostics_sdk/__init__.py create mode 100644 tests/aignostics_sdk/smoke_test.py diff --git a/pyproject.toml b/pyproject.toml index da9b3df9..b3229fd4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -196,6 +196,7 @@ markers = [ "unit: Solitary unit tests - test a layer of a module in isolation with all dependencies mocked, except interaction with shared utils and the systems module. Unit tests must be able to pass offline, i.e. not calls to external services. The timeout should not be bigger than the default 10s, and must be <5 min.", "integration: Sociable integration tests - test interactions across architectural layers (e.g. CLI/GUI→Service, Service→Utils) or between modules (e.g. Application→Platform), using real SDK collaborators, real file I/O, real subprocesses, and real Docker containers. Integration test must be able to pass offline, i.e. mock external services (Aignostics Platform API, Auth0, S3/GCS buckets, IDC). The timeout should not be bigger than the default 10s, and must be <5 min.", "e2e: End-to-end tests - test complete workflows with real external network services (Aignostics Platform API, cloud storage, IDC, etc). If the test timeout is >= 5 min and < 60 min, additionally mark as `long_running`, if >= 60min mark as 'very_long_running'.", + "slim: Tests for the aignostics-sdk slim package distribution.", ] md_report = true md_report_output = "reports/pytest.md" diff --git a/tests/aignostics_sdk/__init__.py b/tests/aignostics_sdk/__init__.py new file mode 100644 index 00000000..5f230681 --- /dev/null +++ b/tests/aignostics_sdk/__init__.py @@ -0,0 +1 @@ +"""Tests for the aignostics-sdk slim package distribution.""" diff --git a/tests/aignostics_sdk/smoke_test.py b/tests/aignostics_sdk/smoke_test.py new file mode 100644 index 00000000..473c8acc --- /dev/null +++ b/tests/aignostics_sdk/smoke_test.py @@ -0,0 +1,92 @@ +"""Smoke tests for the aignostics-sdk slim package. + +These tests verify the slim distribution works in isolation: +- Correct imports resolve +- Core constants are accessible + +Note: The aignostics-sdk CLI entry point (aignostics_sdk.cli) is pending +PYSDK-137 (CLI carve-out). The test_slim_cli_entry_point test is marked +xfail until that phase lands. + +Note: Dependency slimming (removal of heavy deps such as openslide, nicegui, +etc.) is pending PYSDK-138 (dependency split). Until that phase merges, +aignostics-sdk carries the full dependency tree. +""" + +from __future__ import annotations + +import subprocess +import sys + +import pytest + + +@pytest.mark.unit +@pytest.mark.slim +def test_platform_client_importable() -> None: + """Core import from aignostics_sdk.platform works.""" + from aignostics_sdk.platform import Client + + assert Client is not None + + +@pytest.mark.unit +@pytest.mark.slim +def test_utils_importable() -> None: + """Core imports from aignostics_sdk.utils work.""" + from aignostics_sdk.utils import BaseService, Health + + assert BaseService is not None + assert Health is not None + + +@pytest.mark.unit +@pytest.mark.slim +def test_aignx_codegen_importable() -> None: + """Bundled codegen is accessible.""" + from aignx.codegen.exceptions import ApiException + + assert ApiException is not None + + +@pytest.mark.unit +@pytest.mark.slim +@pytest.mark.xfail( + reason="aignostics_sdk.cli module does not exist yet — pending PYSDK-137 (CLI carve-out)", + strict=True, +) +def test_slim_cli_entry_point() -> None: + """aignostics-sdk CLI entry point exits 0. + + This test is xfail until PYSDK-137 creates the aignostics_sdk.cli module + that aggregates the slim subcommands (user, sdk). + """ + result = subprocess.run( + [sys.executable, "-m", "aignostics_sdk.cli", "--help"], + capture_output=True, + text=True, + timeout=30, + check=False, + ) + assert result.returncode == 0 + assert "user" in result.stdout + assert "sdk" in result.stdout + + +@pytest.mark.unit +@pytest.mark.slim +def test_project_name_preserved() -> None: + """__project_name__ is 'aignostics' for backward compat (env vars, token cache).""" + from aignostics_sdk.utils._constants import __project_name__ + + assert __project_name__ == "aignostics" + + +@pytest.mark.unit +@pytest.mark.slim +def test_version_available() -> None: + """Package version is accessible.""" + from aignostics_sdk.utils._constants import __version__ + + assert __version__ is not None + assert len(__version__) > 0