Skip to content

Unit Tests - Python#738

Merged
ChiragAgg5k merged 11 commits intoappwrite:masterfrom
mvarendorff:feat-680-add-unit-tests-python
Apr 20, 2026
Merged

Unit Tests - Python#738
ChiragAgg5k merged 11 commits intoappwrite:masterfrom
mvarendorff:feat-680-add-unit-tests-python

Conversation

@mvarendorff
Copy link
Copy Markdown
Contributor

@mvarendorff mvarendorff commented Nov 4, 2023

What does this PR do?

This PR adds generated unit tests to the Python SDK.

Test Plan

Generate the SDK, weave hands to get the dependencies installed (my IDE did it for me, I have no clue about Python, I am sorry!), then run python3 -m unittest.

Related PRs and Issues

#680

Have you read the Contributing Guidelines on issues?

Yup


Discord username for swag as requested by Tessa: yestheory

@mvarendorff mvarendorff marked this pull request as draft November 19, 2023 14:33
@mvarendorff mvarendorff force-pushed the feat-680-add-unit-tests-python branch from 0528146 to ebc8868 Compare November 19, 2023 15:40
@mvarendorff mvarendorff marked this pull request as ready for review November 19, 2023 15:40
@abnegate
Copy link
Copy Markdown
Member

Are you make these test run automatically with the existing tests?

@lohanidamodar
Copy link
Copy Markdown
Member

Are you make these test run automatically with the existing tests?

@abnegate I don't think we can do that yet. But we want to use these test to run in the appwrite/sdk-for-python with github acitons.

@lohanidamodar
Copy link
Copy Markdown
Member

@abnegate let's get this merged in a different branch and sync

@ChiragAgg5k
Copy link
Copy Markdown
Member

Quick triage check: is this PR still active? It has been inactive for a long time and there is newer testing work in the repo now. If you still plan to continue, please share status/rebase plan; otherwise we can close it for now.

@mvarendorff mvarendorff force-pushed the feat-680-add-unit-tests-python branch from ebc8868 to 864a059 Compare April 1, 2026 06:37
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 1, 2026

Greptile Summary

This PR adds generated unit tests to the Python SDK, covering Query, Role, Permission, ID, Operator, and all service methods (via requests_mock). It also wires up python -m unittest in the CI validation workflow. Previously flagged issues (debug echo statement, missing False/None literal replacements) are fully resolved in this revision.

Confidence Score: 5/5

Safe to merge — all previously blocking issues are resolved, and remaining findings are minor style suggestions.

Previously flagged P0/P1 issues (debug echo, missing false→False/null→None) are fully addressed. The two remaining comments are P2: requests_mock in requirements.txt alongside its correct optional placement in pyproject.toml, and an integer-to-float cast that doesn't cause test failures. Neither blocks merge.

templates/python/requirements.txt.twig — minor inconsistency with pyproject.toml.twig on test dependency scoping.

Important Files Changed

Filename Overview
src/SDK/Language/Python.php Adds getFiles() entries for all test templates, new getResponseModelExample() helper, and responseModelExample/requestModelExample Twig filters. Previously flagged issues resolved. Minor: integer properties cast to float before JSON encoding.
templates/python/requirements.txt.twig Adds requests_mock==1.11.0 to main requirements; this test-only library is already correctly placed as an optional [test] dependency in pyproject.toml.twig, creating an inconsistency.
templates/python/test/services/test_service.py.twig Generates per-service unit tests using requests_mock; correctly handles webAuth, location, and model response types.
templates/python/pyproject.toml.twig Adds requests_mock==1.11.0 as an optional [test] dependency — correctly scoped. The pip install -e .[test] CI change aligns with this.
.github/workflows/sdk-build-validation.yml Switches Python install to pip install -e .[test] and adds python -m unittest for test discovery — straightforward and correct.

Reviews (5): Last reviewed commit: "chore: fix linting" | Re-trigger Greptile

Comment thread src/SDK/Language/Python.php Outdated
Comment thread src/SDK/Language/Python.php Outdated
Comment thread templates/python/requirements.txt.twig
@mvarendorff mvarendorff marked this pull request as draft April 1, 2026 06:43
@mvarendorff mvarendorff force-pushed the feat-680-add-unit-tests-python branch from 864a059 to 6f4f990 Compare April 10, 2026 13:41
@mvarendorff mvarendorff marked this pull request as ready for review April 10, 2026 15:02
@mvarendorff
Copy link
Copy Markdown
Contributor Author

@ChiragAgg5k took me a little while to get to it but this one is finally ready as well 🤞 Let me know if I missed anything :)

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 10, 2026

Tip:

Greploop — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.

Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

@ChiragAgg5k ChiragAgg5k merged commit d280f89 into appwrite:master Apr 20, 2026
93 of 94 checks passed
@mvarendorff mvarendorff deleted the feat-680-add-unit-tests-python branch April 20, 2026 09:09
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.

4 participants