Skip to content

feat(python): Add client for test results.#338

Merged
ian-sift merged 31 commits into
mainfrom
test-results-client
Oct 13, 2025
Merged

feat(python): Add client for test results.#338
ian-sift merged 31 commits into
mainfrom
test-results-client

Conversation

@ian-sift
Copy link
Copy Markdown
Contributor

@ian-sift ian-sift commented Oct 6, 2025

Added new integration test that exercises new client

@ian-sift ian-sift force-pushed the test-results-client branch from 2847096 to 8232130 Compare October 9, 2025 01:27
@ian-sift ian-sift force-pushed the test-results-client branch from b489647 to 7c26c80 Compare October 9, 2025 06:34
Comment thread python/lib/sift_client/_tests/resources/test_results.py
Comment thread python/lib/sift_client/_tests/resources/test_results.py
Comment thread python/lib/sift_client/_tests/resources/test_results.py Outdated
Comment thread python/lib/sift_client/sift_types/test_report.py
Comment thread python/lib/sift_client/sift_types/test_report.py
Comment thread python/lib/sift_client/sift_types/test_report.py Outdated
Comment thread python/lib/sift_client/sift_types/test_report.py Outdated
Comment thread python/lib/sift_client/resources/test_results.py Outdated
Comment thread python/lib/sift_client/sift_types/test_report.py Outdated
Comment thread python/lib/sift_client/sift_types/test_report.py
Comment thread python/lib/sift_client/resources/test_results.py
Comment thread python/lib/sift_client/sift_types/test_report.py
@alexluck-sift
Copy link
Copy Markdown
Collaborator

alexluck-sift commented Oct 11, 2025

Generally looks good, but please take a pass for consistency with the existing Resources. I called out some of these.

Also: https://github.com/sift-stack/sift/blob/main/python/lib/sift_client/_internal/CONTRIBUTING.md

@alexluck-sift
Copy link
Copy Markdown
Collaborator

An Idea to have consistency in namespacing and also clear differentiation between functions acting on different types would be to break these out into multiple "resources" within the same TestResults namespace. This may be a good pattern to keep things organized and leverage the same function names.

What do you think?

class TestResultsStepsAPIAsync(ResourceBase):
    def __init__(self, sift_client: SiftClient):
        super().__init__(sift_client)
        self._low_level_client = TestResultsLowLevelClient(
        grpc_client=self.client.grpc_client
        )

    def create(self) -> TestStep: ...
    def list_(self) -> list[TestStep]: ...
    ...

class TestResultsMeasurementsAPIAsync(ResourceBase):
    def __init__(self, sift_client: SiftClient):
        super().__init__(sift_client)
        self._low_level_client = TestResultsLowLevelClient(
            grpc_client=self.client.grpc_client
        )

    def create(self) -> Measurement: ...
    def list_(self) -> list[Measurement]: ...
    ...

class TestResultsAPIAsync(ResourceBase):
    def __init__(self, sift_client: SiftClient):
        super().__init__(sift_client)
        self._low_level_client = TestResultsLowLevelClient(
            grpc_client=self.client.grpc_client
        )
        self._upload_client = UploadLowLevelClient(rest_client=self.client.rest_client)
        
        self.steps = TestResultsStepsAPIAsync(self.client)
        self.measurements = TestResultsMeasurementsAPIAsync(self.client)

    def create(self) -> TestReport: ...
    def list_(self) -> list[TestReport]: ...
    ...

# Usage
client = SiftClient(api_key="your_api_key")
test_result = client.test_results.create(...)
test_step =  client.test_results.steps.create(...)
test_measurement = client.test_results.measurements.create(...)

Comment thread python/lib/sift_client/resources/test_results.py Outdated
Comment thread python/lib/sift_client/resources/test_results.py Outdated
Comment thread python/lib/sift_client/resources/test_results.py
Comment thread python/lib/sift_client/resources/test_results.py
Comment thread python/lib/sift_client/resources/test_results.py Outdated
Comment thread python/lib/sift_client/resources/test_results.py
Comment thread python/lib/sift_client/_tests/resources/test_results.py
Comment thread python/lib/sift_client/_tests/resources/test_results.py
Comment thread python/lib/sift_client/_tests/resources/test_results.py
Comment thread python/lib/sift_client/_tests/resources/test_results.py
Comment thread python/lib/sift_client/resources/test_results.py Outdated
Copy link
Copy Markdown
Collaborator

@alexluck-sift alexluck-sift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@ian-sift ian-sift merged commit dbf612a into main Oct 13, 2025
10 checks passed
@ian-sift ian-sift deleted the test-results-client branch October 13, 2025 23:37
@ian-sift ian-sift restored the test-results-client branch October 14, 2025 02:02
@ian-sift ian-sift deleted the test-results-client branch November 11, 2025 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants