workers-runtime-sdk 1.9.0__tar.gz → 1.9.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/CHANGELOG.md +18 -0
  2. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/PKG-INFO +1 -1
  3. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/pyproject.toml +1 -1
  4. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/_workers_sdk_entropy_import_context.py +10 -0
  5. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/pyproject.toml +7 -2
  6. workers_runtime_sdk-1.9.2/tests/conftest.py +68 -0
  7. workers_runtime_sdk-1.9.2/tests/test_django_databases.py +37 -0
  8. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/test_in_workerd.py +8 -15
  9. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/pyproject.toml +3 -1
  10. workers_runtime_sdk-1.9.2/tests/web-frameworks-test/django-databases/pyproject.toml +16 -0
  11. workers_runtime_sdk-1.9.2/tests/web-frameworks-test/django-databases/src/django_db_config.py +61 -0
  12. workers_runtime_sdk-1.9.2/tests/web-frameworks-test/django-databases/src/django_db_helpers.py +100 -0
  13. workers_runtime_sdk-1.9.2/tests/web-frameworks-test/django-databases/src/test_mysql.py +35 -0
  14. workers_runtime_sdk-1.9.2/tests/web-frameworks-test/django-databases/src/test_postgresql.py +35 -0
  15. workers_runtime_sdk-1.9.2/tests/web-frameworks-test/django-databases/src/worker.py +9 -0
  16. workers_runtime_sdk-1.9.2/tests/web-frameworks-test/django-databases/wrangler.jsonc +18 -0
  17. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/pyproject.toml +3 -1
  18. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/worker.py +4 -11
  19. workers_runtime_sdk-1.9.2/tests/web-frameworks-test/flask-tests/pyproject.toml +9 -0
  20. workers_runtime_sdk-1.9.2/tests/workerd-test/asgi/pyproject.toml +9 -0
  21. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/asgi/worker.py +2 -20
  22. workers_runtime_sdk-1.9.2/tests/workerd-test/asgi-ws-disconnect/pyproject.toml +9 -0
  23. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/asgi-ws-disconnect/worker.py +2 -19
  24. workers_runtime_sdk-1.9.2/tests/workerd-test/durable-object/pyproject.toml +8 -0
  25. workers_runtime_sdk-1.9.2/tests/workerd-test/durable-object-abort/pyproject.toml +8 -0
  26. workers_runtime_sdk-1.9.2/tests/workerd-test/durable-object-inheritance/pyproject.toml +8 -0
  27. workers_runtime_sdk-1.9.2/tests/workerd-test/durable-object-websocket/pyproject.toml +8 -0
  28. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/pyproject.toml +5 -0
  29. workers_runtime_sdk-1.9.2/tests/workerd-test/entropy-patches/tests/test_jsonschema.py +9 -0
  30. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/worker.py +1 -0
  31. workers_runtime_sdk-1.9.2/tests/workerd-test/http-client/pyproject.toml +8 -0
  32. workers_runtime_sdk-1.9.2/tests/workerd-test/python-rpc/pyproject.toml +8 -0
  33. workers_runtime_sdk-1.9.2/tests/workerd-test/sdk/pyproject.toml +9 -0
  34. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/sdk/worker.py +2 -21
  35. workers_runtime_sdk-1.9.2/tests/workerd-test/wsgi/pyproject.toml +9 -0
  36. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/wsgi/worker.py +2 -20
  37. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/uv.lock +12 -1
  38. workers_runtime_sdk-1.9.0/tests/conftest.py +0 -116
  39. workers_runtime_sdk-1.9.0/tests/web-frameworks-test/flask-tests/pyproject.toml +0 -8
  40. workers_runtime_sdk-1.9.0/tests/workerd-test/asgi/pyproject.toml +0 -5
  41. workers_runtime_sdk-1.9.0/tests/workerd-test/asgi-ws-disconnect/pyproject.toml +0 -5
  42. workers_runtime_sdk-1.9.0/tests/workerd-test/durable-object/pyproject.toml +0 -5
  43. workers_runtime_sdk-1.9.0/tests/workerd-test/durable-object-inheritance/pyproject.toml +0 -5
  44. workers_runtime_sdk-1.9.0/tests/workerd-test/durable-object-websocket/pyproject.toml +0 -5
  45. workers_runtime_sdk-1.9.0/tests/workerd-test/http-client/pyproject.toml +0 -5
  46. workers_runtime_sdk-1.9.0/tests/workerd-test/python-rpc/pyproject.toml +0 -5
  47. workers_runtime_sdk-1.9.0/tests/workerd-test/sdk/pyproject.toml +0 -5
  48. workers_runtime_sdk-1.9.0/tests/workerd-test/workflow/pyproject.toml +0 -5
  49. workers_runtime_sdk-1.9.0/tests/workerd-test/wsgi/pyproject.toml +0 -5
  50. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/.gitignore +0 -0
  51. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/AGENTS.md +0 -0
  52. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/README.md +0 -0
  53. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/_cloudflare_compat_flags.pyi +0 -0
  54. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/_pyodide_entrypoint_helper.pyi +0 -0
  55. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/_workers_sdk_package_patches.py +0 -0
  56. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/_workers_sdk_patch_loader.pth +0 -0
  57. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/_workers_sdk_patch_loader.py +0 -0
  58. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/asgi.py +0 -0
  59. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/__init__.py +0 -0
  60. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/asgi.py +0 -0
  61. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/blob.py +0 -0
  62. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/entrypoints.py +0 -0
  63. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/fetch.py +0 -0
  64. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/formdata.py +0 -0
  65. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/py.typed +0 -0
  66. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/request.py +0 -0
  67. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/response.py +0 -0
  68. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/rpc.py +0 -0
  69. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/types.py +0 -0
  70. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/utils.py +0 -0
  71. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/workflows.js +0 -0
  72. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/workflows.py +0 -0
  73. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/src/workers/wsgi.py +0 -0
  74. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/public/data.json +0 -0
  75. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/public/hello.txt +0 -0
  76. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/conftest.py +0 -0
  77. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_analytics_engine.py +0 -0
  78. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_assets.py +0 -0
  79. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_d1.py +0 -0
  80. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_do.py +0 -0
  81. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_hyperdrive_mysql.py +0 -0
  82. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_hyperdrive_postgresql.py +0 -0
  83. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_images.py +0 -0
  84. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_kv.py +0 -0
  85. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_mtls.py +0 -0
  86. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_queue.py +0 -0
  87. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_r2.py +0 -0
  88. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_ratelimit.py +0 -0
  89. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_vectorize.py +0 -0
  90. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_version_metadata.py +0 -0
  91. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/test_workflow.py +0 -0
  92. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/worker.py +0 -0
  93. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/worker_durable_object.py +0 -0
  94. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/src/worker_workflow.py +0 -0
  95. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/bindings-test/wrangler.jsonc +0 -0
  96. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/test_bindings.py +0 -0
  97. /workers_runtime_sdk-1.9.0/tests/test_web_frameworks.py → /workers_runtime_sdk-1.9.2/tests/test_django.py +0 -0
  98. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/test_fastapi.py +0 -0
  99. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/test_flask.py +0 -0
  100. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/_client.py +0 -0
  101. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/conftest.py +0 -0
  102. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/__init__.py +0 -0
  103. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/api_urls.py +0 -0
  104. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/auth_backend.py +0 -0
  105. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/drf_auth.py +0 -0
  106. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/drf_serializers.py +0 -0
  107. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/drf_throttling.py +0 -0
  108. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/drf_views.py +0 -0
  109. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/forms.py +0 -0
  110. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/middleware.py +0 -0
  111. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/templatetags/__init__.py +0 -0
  112. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/templatetags/custom_tags.py +0 -0
  113. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/urls.py +0 -0
  114. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/django_app/views.py +0 -0
  115. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/templates/base.html +0 -0
  116. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/templates/context_test.html +0 -0
  117. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/templates/csrf_form.html +0 -0
  118. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/templates/hello.html +0 -0
  119. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_async_utilities.py +0 -0
  120. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_auth.py +0 -0
  121. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_caching.py +0 -0
  122. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_cors.py +0 -0
  123. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_csrf.py +0 -0
  124. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_drf_auth_permissions.py +0 -0
  125. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_drf_content_negotiation.py +0 -0
  126. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_drf_serializers.py +0 -0
  127. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_drf_throttling.py +0 -0
  128. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_drf_versioning.py +0 -0
  129. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_drf_views.py +0 -0
  130. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_error_handling.py +0 -0
  131. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_file_uploads.py +0 -0
  132. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_forms.py +0 -0
  133. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_middleware.py +0 -0
  134. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_pagination.py +0 -0
  135. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_request_response.py +0 -0
  136. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_sessions.py +0 -0
  137. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_signals.py +0 -0
  138. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_streaming.py +0 -0
  139. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_templates.py +0 -0
  140. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_url_routing.py +0 -0
  141. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/test_views_basic.py +0 -0
  142. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/src/worker.py +0 -0
  143. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/django-async/wrangler.jsonc +0 -0
  144. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/public/data.json +0 -0
  145. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/public/index.html +0 -0
  146. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/public/style.css +0 -0
  147. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/_client.py +0 -0
  148. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/conftest.py +0 -0
  149. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/static/app.css +0 -0
  150. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/static/data.json +0 -0
  151. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/static/hello.txt +0 -0
  152. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/static/index.html +0 -0
  153. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_assets.py +0 -0
  154. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_error_handling.py +0 -0
  155. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_platform_boundaries.py +0 -0
  156. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_platform_io.py +0 -0
  157. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_platform_lifecycle.py +0 -0
  158. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_response_types.py +0 -0
  159. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_routing.py +0 -0
  160. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_staticfiles.py +0 -0
  161. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_sync_handlers.py +0 -0
  162. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/src/test_websocket.py +0 -0
  163. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/fastapi-tests/wrangler.jsonc +0 -0
  164. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/flask-tests/src/test_response.py +0 -0
  165. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/flask-tests/src/worker.py +0 -0
  166. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/web-frameworks-test/flask-tests/wrangler.jsonc +0 -0
  167. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/asgi/asgi.wd-test +0 -0
  168. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/asgi/tests/test_asgi.py +0 -0
  169. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/asgi/wrangler.jsonc +0 -0
  170. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/asgi-ws-disconnect/asgi-ws-disconnect.wd-test +0 -0
  171. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/asgi-ws-disconnect/tests/test_ws_disconnect.py +0 -0
  172. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/asgi-ws-disconnect/wrangler.jsonc +0 -0
  173. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object/durable-object.wd-test +0 -0
  174. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object/worker.py +0 -0
  175. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object/wrangler.jsonc +0 -0
  176. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-abort/durable-object-abort.wd-test +0 -0
  177. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-abort/worker.py +0 -0
  178. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-abort/wrangler.jsonc +0 -0
  179. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-inheritance/durable-object-inheritance.wd-test +0 -0
  180. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-inheritance/worker.py +0 -0
  181. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-inheritance/wrangler.jsonc +0 -0
  182. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-websocket/durable-object-websocket.wd-test +0 -0
  183. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-websocket/tester.js +0 -0
  184. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-websocket/worker.py +0 -0
  185. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/durable-object-websocket/wrangler.jsonc +0 -0
  186. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/entropy-patches.wd-test +0 -0
  187. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_aiohttp_websocket.py +0 -0
  188. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_langsmith.py +0 -0
  189. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_litestar.py +0 -0
  190. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_mcp.py +0 -0
  191. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_numpy.py +0 -0
  192. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_opentelemetry.py +0 -0
  193. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_pydantic.py +0 -0
  194. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_rust_packages.py +0 -0
  195. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/tests/test_ssl_avoidance.py +0 -0
  196. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/entropy-patches/wrangler.jsonc +0 -0
  197. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/http-client/http-client.wd-test +0 -0
  198. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/http-client/origin.py +0 -0
  199. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/http-client/tests/test_http_client.py +0 -0
  200. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/http-client/tests/test_urllib_request.py +0 -0
  201. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/http-client/worker.py +0 -0
  202. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/http-client/wrangler.jsonc +0 -0
  203. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/python-rpc/python-rpc.wd-test +0 -0
  204. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/python-rpc/worker.js +0 -0
  205. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/python-rpc/worker.py +0 -0
  206. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/python-rpc/wrangler.jsonc +0 -0
  207. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/sdk/sdk.wd-test +0 -0
  208. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/sdk/server.py +0 -0
  209. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/sdk/tests/test_sdk.py +0 -0
  210. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/sdk/wrangler.jsonc +0 -0
  211. {workers_runtime_sdk-1.9.0/tests/workerd-test/durable-object-abort → workers_runtime_sdk-1.9.2/tests/workerd-test/workflow}/pyproject.toml +0 -0
  212. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/workflow/worker.js +0 -0
  213. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/workflow/worker.py +0 -0
  214. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/workflow/workflow.wd-test +0 -0
  215. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/workflow/wrangler.jsonc +0 -0
  216. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/wsgi/tests/test_wsgi.py +0 -0
  217. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/wsgi/wrangler.jsonc +0 -0
  218. {workers_runtime_sdk-1.9.0 → workers_runtime_sdk-1.9.2}/tests/workerd-test/wsgi/wsgi.wd-test +0 -0
@@ -2,6 +2,24 @@
2
2
 
3
3
  <!-- version list -->
4
4
 
5
+ ## v1.9.2 (2026-09-30)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **runtime-sdk**: Fix top-level entropy calls in fastapi >= 0.142.0
10
+ ([#283](https://github.com/cloudflare/workers-py/pull/283),
11
+ [`f0b104e`](https://github.com/cloudflare/workers-py/commit/f0b104eb0b9204fc877f34f59d510f6ef75f1833))
12
+
13
+
14
+ ## v1.9.1 (2026-09-29)
15
+
16
+ ### Bug Fixes
17
+
18
+ - **runtime-sdk**: Add rpds to rust package entropy context
19
+ ([#277](https://github.com/cloudflare/workers-py/pull/277),
20
+ [`a097b7c`](https://github.com/cloudflare/workers-py/commit/a097b7c5d2e5bba17f34d46abb6e39039d4673d4))
21
+
22
+
5
23
  ## v1.9.0 (2026-09-18)
6
24
 
7
25
  ### Bug Fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: workers-runtime-sdk
3
- Version: 1.9.0
3
+ Version: 1.9.2
4
4
  Summary: Python SDK for Cloudflare Workers
5
5
  Project-URL: Homepage, https://github.com/cloudflare/workers-py
6
6
  Project-URL: Bug Tracker, https://github.com/cloudflare/workers-py/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "workers-runtime-sdk"
7
- version = "1.9.0"
7
+ version = "1.9.2"
8
8
  description = "Python SDK for Cloudflare Workers"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -49,6 +49,7 @@ class STATE:
49
49
  @register_create_patch("tiktoken._tiktoken")
50
50
  @register_exec_patch("cryptography.exceptions")
51
51
  @register_exec_patch("jiter")
52
+ @register_exec_patch("rpds")
52
53
  @register_exec_patch("uuid_utils._uuid_utils")
53
54
  @contextmanager
54
55
  def rust_package_context(module):
@@ -228,6 +229,15 @@ def opentelemetry_baggage_context(module):
228
229
  yield
229
230
 
230
231
 
232
+ @register_exec_patch("fastapi.telemetry")
233
+ @contextmanager
234
+ def fastapi_telemetry_context(module):
235
+ # fastapi 0.142.0 added opentelemetry support
236
+ # which creates a UUID-backed key.
237
+ with allow_bad_entropy_calls_for_version("fastapi", 1, (0, 142, 0)):
238
+ yield
239
+
240
+
231
241
  @register_exec_patch("litestar.openapi.controller")
232
242
  @register_exec_patch("litestar.constants")
233
243
  @contextmanager
@@ -7,13 +7,18 @@ dependencies = [
7
7
  "pytest-asyncio<1.2.0",
8
8
  # These are for hyperdrive tests
9
9
  "pg8000",
10
- "pymysql",
10
+ # There is a regression in upstream pymysql.
11
+ # Remove when the following PR is merged and released.
12
+ # https://github.com/PyMySQL/PyMySQL/pull/1275
13
+ "pymysql<=1.2.0",
11
14
  "aiomysql",
12
15
  "psycopg[binary]; python_version >= '3.14'",
13
16
  "asyncpg; python_version >= '3.14'",
14
17
  "cryptography",
15
18
  "testlib",
19
+ "workers-runtime-sdk",
16
20
  ]
17
21
 
18
22
  [tool.uv.sources]
19
- testlib = { path = "../testlib/dist/testlib-0.0.0-py3-none-any.whl" }
23
+ testlib = { path = "../packages/testlib" }
24
+ workers-runtime-sdk = { path = "../packages/runtime-sdk" }
@@ -0,0 +1,68 @@
1
+ """Shared fixtures and helpers for the host-side test suite."""
2
+
3
+ from pathlib import Path
4
+ from typing import Any
5
+
6
+ import pytest
7
+ from testlib.host import (
8
+ COMPAT_CONFIGS,
9
+ CompatConfig,
10
+ dev_server,
11
+ )
12
+ from testlib.host import (
13
+ register_in_worker_suites as register_testlib_suites,
14
+ )
15
+
16
+ __all__ = ["dev_server"]
17
+
18
+
19
+ TEST_DIR: Path = Path(__file__).parent
20
+
21
+ OPT_IN_MARKERS: tuple[str, ...] = ("hyperdrive",)
22
+
23
+
24
+ def pytest_collection_modifyitems(
25
+ config: pytest.Config, items: list[pytest.Item]
26
+ ) -> None:
27
+ """Skip opt-in suites unless the run explicitly asks for them via ``-m``."""
28
+ markexpr: str = config.getoption("markexpr")
29
+ for marker in OPT_IN_MARKERS:
30
+ if marker in markexpr:
31
+ continue
32
+ skip = pytest.mark.skip(reason=f"needs local services; run with -m {marker}")
33
+ for item in items:
34
+ if marker in item.keywords:
35
+ item.add_marker(skip)
36
+
37
+
38
+ @pytest.fixture(
39
+ scope="module",
40
+ params=COMPAT_CONFIGS,
41
+ ids=[c.python_version for c in COMPAT_CONFIGS],
42
+ )
43
+ def compat_config(request: pytest.FixtureRequest) -> CompatConfig:
44
+ return request.param
45
+
46
+
47
+ @pytest.fixture(scope="module")
48
+ def worker_project_dir() -> Path:
49
+ """Worker project the `dev_server` fixture should serve.
50
+
51
+ Test modules using `dev_server` must override this fixture.
52
+ """
53
+ raise NotImplementedError(
54
+ "override the `worker_project_dir` fixture in your test module"
55
+ )
56
+
57
+
58
+ @pytest.fixture(scope="module")
59
+ def dev_startup_timeout():
60
+ return 120
61
+
62
+
63
+ def register_in_worker_suites(
64
+ namespace: dict[str, Any],
65
+ src_dir: Path,
66
+ marks: dict[str, pytest.MarkDecorator] | None = None,
67
+ ) -> None:
68
+ register_testlib_suites(namespace, src_dir, marks=marks)
@@ -0,0 +1,37 @@
1
+ # pyright: reportAttributeAccessIssue=false, reportMissingImports=false
2
+
3
+ """Stock Django database backends running through Hyperdrive in workerd."""
4
+
5
+ from pathlib import Path
6
+
7
+ import pytest
8
+ from conftest import COMPAT_CONFIGS, CompatConfig, register_in_worker_suites
9
+
10
+ DJANGO_DATABASES_DIR: Path = (
11
+ Path(__file__).parent / "web-frameworks-test" / "django-databases"
12
+ )
13
+ DJANGO_DATABASES_SRC_DIR: Path = DJANGO_DATABASES_DIR / "src"
14
+ PYTHON_314_CONFIGS = [
15
+ config for config in COMPAT_CONFIGS if config.python_version == "3.14"
16
+ ]
17
+ SUITE_MARKS: dict[str, pytest.MarkDecorator] = {
18
+ "postgresql": pytest.mark.hyperdrive,
19
+ "mysql": pytest.mark.hyperdrive,
20
+ }
21
+
22
+
23
+ @pytest.fixture(scope="module")
24
+ def worker_project_dir() -> Path:
25
+ return DJANGO_DATABASES_DIR
26
+
27
+
28
+ @pytest.fixture(
29
+ scope="module",
30
+ params=PYTHON_314_CONFIGS,
31
+ ids=[config.python_version for config in PYTHON_314_CONFIGS],
32
+ )
33
+ def compat_config(request: pytest.FixtureRequest) -> CompatConfig:
34
+ return request.param
35
+
36
+
37
+ register_in_worker_suites(globals(), DJANGO_DATABASES_SRC_DIR, marks=SUITE_MARKS)
@@ -7,13 +7,15 @@ import pytest
7
7
  from conftest import (
8
8
  COMPAT_CONFIGS,
9
9
  CompatConfig,
10
+ )
11
+ from testlib.host import (
10
12
  configure_compatibility,
13
+ link_packages,
14
+ pywrangler_sync,
11
15
  )
12
16
 
13
17
  TEST_DIR = Path(__file__).parent
14
18
  WORKERD_TESTS = TEST_DIR / "workerd-test"
15
- WORKERS_PY = TEST_DIR.parent.parent / "cli"
16
- WORKERS_RUNTIME_SDK = TEST_DIR.parent / "src"
17
19
  DISK_SERVICE_NAME = "TEST_TMPDIR"
18
20
 
19
21
 
@@ -123,23 +125,14 @@ def test_in_workerd( # noqa: PLR0913, PLR0917 (too-many-arguments)
123
125
  target = tmp_path / test_dir.name
124
126
  disk_service_dir = target / DISK_SERVICE_NAME
125
127
  shutil.copytree(test_dir, target, ignore=shutil.ignore_patterns(".venv"))
128
+ # Makes the project's `../packages/{runtime-sdk,testlib}` sources resolve
129
+ # so `sync` vendors the working-tree SDK and testlib.
130
+ link_packages(tmp_path)
126
131
  disk_service_dir.mkdir(exist_ok=True)
127
132
 
128
133
  configure_compatibility(target / "wrangler.jsonc", compat_config)
129
134
 
130
- pywrangler_cmd = ["uv", "run", "--no-project", "--with", WORKERS_PY, "pywrangler"]
131
-
132
- subprocess.run(
133
- [*pywrangler_cmd, "sync"],
134
- cwd=target,
135
- check=True,
136
- env=os.environ | {"_PYODIDE_EXTRA_MOUNTS": str(tmp_path)},
137
- )
138
-
139
- # Copy runtime-sdk to the python modules as well
140
- # FIXME: remove this and pass runtime-sdk as a dependency explicitly after
141
- # https://github.com/cloudflare/workers-py/pull/81 is merged
142
- shutil.copytree(WORKERS_RUNTIME_SDK, target / "python_modules", dirs_exist_ok=True)
135
+ pywrangler_sync(target, os.environ | {"_PYODIDE_EXTRA_MOUNTS": str(tmp_path)})
143
136
 
144
137
  modules = embed(target / "python_modules", target, level=1) + embed(
145
138
  target / "tests", target, level=1
@@ -11,7 +11,9 @@ dependencies = [
11
11
  "pytest",
12
12
  "pytest-asyncio<1.2.0",
13
13
  "testlib",
14
+ "workers-runtime-sdk",
14
15
  ]
15
16
 
16
17
  [tool.uv.sources]
17
- testlib = { path = "../testlib/dist/testlib-0.0.0-py3-none-any.whl" }
18
+ testlib = { path = "../packages/testlib" }
19
+ workers-runtime-sdk = { path = "../packages/runtime-sdk" }
@@ -0,0 +1,16 @@
1
+ [project]
2
+ name = "django-databases-test"
3
+ version = "0.1.0"
4
+ requires-python = ">=3.14"
5
+ dependencies = [
6
+ "django>=5.2.8",
7
+ "mysqlclient",
8
+ "psycopg[binary]",
9
+ "pytest",
10
+ "testlib",
11
+ "workers-runtime-sdk",
12
+ ]
13
+
14
+ [tool.uv.sources]
15
+ testlib = { path = "../packages/testlib" }
16
+ workers-runtime-sdk = { path = "../packages/runtime-sdk" }
@@ -0,0 +1,61 @@
1
+ # pyright: reportMissingImports=false
2
+
3
+ """Django settings for stock backends running through Hyperdrive."""
4
+
5
+ import os
6
+
7
+ import django
8
+ from django.conf import settings
9
+
10
+ from workers import env
11
+
12
+ os.environ.setdefault("DJANGO_ALLOW_ASYNC_UNSAFE", "true")
13
+
14
+ HYPERDRIVE_POSTGRESQL = "hyperdrive_postgresql"
15
+ HYPERDRIVE_MYSQL = "hyperdrive_mysql"
16
+
17
+
18
+ def _postgresql_database() -> dict[str, object]:
19
+ hyperdrive = env.HYPERDRIVE_PG
20
+ return {
21
+ "ENGINE": "django.db.backends.postgresql",
22
+ "HOST": hyperdrive.host,
23
+ "PORT": str(hyperdrive.port),
24
+ "USER": hyperdrive.user,
25
+ "PASSWORD": hyperdrive.password,
26
+ "NAME": hyperdrive.database,
27
+ "CONN_MAX_AGE": 0,
28
+ "OPTIONS": {"sslmode": "disable"},
29
+ "DISABLE_SERVER_SIDE_CURSORS": True,
30
+ }
31
+
32
+
33
+ def _mysql_database() -> dict[str, object]:
34
+ hyperdrive = env.HYPERDRIVE_MYSQL
35
+ return {
36
+ "ENGINE": "django.db.backends.mysql",
37
+ "HOST": hyperdrive.host,
38
+ "PORT": str(hyperdrive.port),
39
+ "USER": hyperdrive.user,
40
+ "PASSWORD": hyperdrive.password,
41
+ "NAME": hyperdrive.database,
42
+ "CONN_MAX_AGE": 0,
43
+ "OPTIONS": {"ssl_mode": "DISABLED"},
44
+ }
45
+
46
+
47
+ settings.configure(
48
+ DEBUG=False,
49
+ SECRET_KEY="test-secret-key-for-workers-py",
50
+ INSTALLED_APPS=[],
51
+ DATABASES={
52
+ "default": {"ENGINE": "django.db.backends.dummy"},
53
+ HYPERDRIVE_POSTGRESQL: _postgresql_database(),
54
+ HYPERDRIVE_MYSQL: _mysql_database(),
55
+ },
56
+ TIME_ZONE="UTC",
57
+ USE_TZ=True,
58
+ DEFAULT_AUTO_FIELD="django.db.models.BigAutoField",
59
+ )
60
+
61
+ django.setup()
@@ -0,0 +1,100 @@
1
+ """ORM assertions shared by the independent Django backend suites."""
2
+
3
+ import uuid
4
+ from collections.abc import Iterator
5
+ from contextlib import contextmanager
6
+
7
+ import pytest
8
+ from django.db import connections, models, transaction
9
+ from django.test.utils import isolate_apps
10
+
11
+
12
+ class Rollback(Exception):
13
+ """Raised to roll back an atomic block."""
14
+
15
+
16
+ def _table_name() -> str:
17
+ return f"dht_{uuid.uuid4().hex}"
18
+
19
+
20
+ @contextmanager
21
+ def _temporary_model(alias: str) -> Iterator[type[models.Model]]:
22
+ table_name = _table_name()
23
+ connection = connections[alias]
24
+
25
+ with isolate_apps():
26
+
27
+ class TemporaryModel(models.Model):
28
+ name = models.CharField(max_length=100)
29
+ value = models.IntegerField()
30
+ float_value = models.FloatField(default=0.0)
31
+ is_active = models.BooleanField(default=False)
32
+
33
+ class Meta:
34
+ app_label = "hyperdrive_tests"
35
+ db_table = table_name
36
+
37
+ created = False
38
+ try:
39
+ with connection.schema_editor() as schema_editor:
40
+ schema_editor.create_model(TemporaryModel)
41
+ created = True
42
+ yield TemporaryModel
43
+ finally:
44
+ if created:
45
+ with connection.schema_editor() as schema_editor:
46
+ schema_editor.delete_model(TemporaryModel)
47
+
48
+
49
+ def assert_connectivity(alias: str) -> None:
50
+ connection = connections[alias]
51
+ connection.ensure_connection()
52
+ assert connection.is_usable()
53
+
54
+
55
+ def assert_crud(alias: str) -> None:
56
+ with _temporary_model(alias) as model:
57
+ objects = model.objects.using(alias)
58
+ objects.create(name="alpha", value=1)
59
+ objects.create(name="beta", value=2)
60
+
61
+ assert list(
62
+ objects.filter(name__in=["alpha", "beta"])
63
+ .order_by("name")
64
+ .values_list("name", "value")
65
+ ) == [("alpha", 1), ("beta", 2)]
66
+
67
+ assert objects.filter(name="alpha").update(value=11) == 1
68
+ assert objects.get(name="alpha").value == 11
69
+
70
+ assert objects.filter(name="alpha").delete()[0] == 1
71
+ assert objects.count() == 1
72
+ assert objects.get(name="beta").value == 2
73
+
74
+
75
+ def assert_data_types(alias: str) -> None:
76
+ with _temporary_model(alias) as model:
77
+ objects = model.objects.using(alias)
78
+ created = objects.create(
79
+ name="hello",
80
+ value=42,
81
+ float_value=3.14,
82
+ is_active=True,
83
+ )
84
+ row = objects.get(pk=created.pk)
85
+
86
+ assert row.name == "hello"
87
+ assert row.value == 42
88
+ assert abs(row.float_value - 3.14) < 0.001
89
+ assert row.is_active is True
90
+
91
+
92
+ def assert_transaction_rollback(alias: str) -> None:
93
+ with _temporary_model(alias) as model:
94
+ objects = model.objects.using(alias)
95
+
96
+ with pytest.raises(Rollback), transaction.atomic(using=alias):
97
+ objects.create(name="should_disappear", value=1)
98
+ raise Rollback
99
+
100
+ assert objects.count() == 0
@@ -0,0 +1,35 @@
1
+ # pyright: reportMissingImports=false
2
+
3
+ """Stock Django MySQL backend running through the HYPERDRIVE_MYSQL binding."""
4
+
5
+ import pytest
6
+ from django.db import connections
7
+ from django_db_config import HYPERDRIVE_MYSQL
8
+ from django_db_helpers import (
9
+ assert_connectivity,
10
+ assert_crud,
11
+ assert_data_types,
12
+ assert_transaction_rollback,
13
+ )
14
+
15
+
16
+ @pytest.fixture(autouse=True)
17
+ def close_connections():
18
+ yield
19
+ connections[HYPERDRIVE_MYSQL].close()
20
+
21
+
22
+ def test_connectivity():
23
+ assert_connectivity(HYPERDRIVE_MYSQL)
24
+
25
+
26
+ def test_crud():
27
+ assert_crud(HYPERDRIVE_MYSQL)
28
+
29
+
30
+ def test_data_types():
31
+ assert_data_types(HYPERDRIVE_MYSQL)
32
+
33
+
34
+ def test_transaction_rollback():
35
+ assert_transaction_rollback(HYPERDRIVE_MYSQL)
@@ -0,0 +1,35 @@
1
+ # pyright: reportMissingImports=false
2
+
3
+ """Stock Django PostgreSQL backend running through the HYPERDRIVE_PG binding."""
4
+
5
+ import pytest
6
+ from django.db import connections
7
+ from django_db_config import HYPERDRIVE_POSTGRESQL
8
+ from django_db_helpers import (
9
+ assert_connectivity,
10
+ assert_crud,
11
+ assert_data_types,
12
+ assert_transaction_rollback,
13
+ )
14
+
15
+
16
+ @pytest.fixture(autouse=True)
17
+ def close_connections():
18
+ yield
19
+ connections[HYPERDRIVE_POSTGRESQL].close()
20
+
21
+
22
+ def test_connectivity():
23
+ assert_connectivity(HYPERDRIVE_POSTGRESQL)
24
+
25
+
26
+ def test_crud():
27
+ assert_crud(HYPERDRIVE_POSTGRESQL)
28
+
29
+
30
+ def test_data_types():
31
+ assert_data_types(HYPERDRIVE_POSTGRESQL)
32
+
33
+
34
+ def test_transaction_rollback():
35
+ assert_transaction_rollback(HYPERDRIVE_POSTGRESQL)
@@ -0,0 +1,9 @@
1
+ # pyright: reportMissingImports=false
2
+
3
+ """Django database backend test worker."""
4
+
5
+ from testlib.entrypoint import TestRunnerEntrypoint
6
+
7
+
8
+ class Default(TestRunnerEntrypoint):
9
+ pass
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "django-databases-test",
3
+ "main": "src/worker.py",
4
+ "compatibility_date": "%COMPAT_DATE",
5
+ "compatibility_flags": ["python_workers"],
6
+ "hyperdrive": [
7
+ {
8
+ "binding": "HYPERDRIVE_PG",
9
+ "id": "00000000-0000-0000-0000-000000000001",
10
+ "localConnectionString": "postgres://testuser:testpass@127.0.0.1:5432/testdb"
11
+ },
12
+ {
13
+ "binding": "HYPERDRIVE_MYSQL",
14
+ "id": "00000000-0000-0000-0000-000000000002",
15
+ "localConnectionString": "mysql://testuser:testpass@127.0.0.1:3306/testdb"
16
+ }
17
+ ]
18
+ }
@@ -8,7 +8,9 @@ dependencies = [
8
8
  "pytest",
9
9
  "pytest-asyncio<1.2.0",
10
10
  "testlib",
11
+ "workers-runtime-sdk",
11
12
  ]
12
13
 
13
14
  [tool.uv.sources]
14
- testlib = { path = "../testlib/dist/testlib-0.0.0-py3-none-any.whl" }
15
+ testlib = { path = "../packages/testlib" }
16
+ workers-runtime-sdk = { path = "../packages/runtime-sdk" }
@@ -30,21 +30,12 @@ from fastapi.responses import (
30
30
  from fastapi.responses import Response as FastAPIResponse
31
31
  from fastapi.staticfiles import StaticFiles
32
32
  from pydantic import BaseModel
33
- from pyodide.webloop import WebLoop
34
33
  from starlette.background import BackgroundTask
35
34
  from starlette.middleware.gzip import GZipMiddleware
36
- from testlib.entrypoint import TestRunner
35
+ from testlib.entrypoint import RunSuiteRequest, TestRunner
37
36
 
38
37
  import asgi
39
38
 
40
-
41
- async def _noop(*args):
42
- pass
43
-
44
-
45
- WebLoop.shutdown_asyncgens = _noop
46
- WebLoop.shutdown_default_executor = _noop
47
-
48
39
  STATIC_DIR = Path(__file__).parent / "static"
49
40
 
50
41
 
@@ -603,7 +594,9 @@ class FastAPIAppPlugin:
603
594
  @app.get("/run-tests/{suite_name:path}")
604
595
  async def run_suite(suite_name: str, request: Request):
605
596
  runner = TestRunner(request.scope["env"], extra_plugins=[FastAPIAppPlugin()])
606
- result = runner.run_suite(suite_name)
597
+ result = runner.run_suite(
598
+ suite_name, RunSuiteRequest.from_query_params(request.query_params)
599
+ )
607
600
  return JSONResponse(result.payload, status_code=result.status)
608
601
 
609
602
 
@@ -0,0 +1,9 @@
1
+ [project]
2
+ name = "flask-tests"
3
+ version = "0.1.0"
4
+ requires-python = ">=3.12"
5
+ dependencies = ["flask", "pytest", "testlib", "workers-runtime-sdk"]
6
+
7
+ [tool.uv.sources]
8
+ testlib = { path = "../packages/testlib" }
9
+ workers-runtime-sdk = { path = "../packages/runtime-sdk" }
@@ -0,0 +1,9 @@
1
+ [project]
2
+ name = "test"
3
+ version = "0.0.0"
4
+ requires-python = ">=3.12"
5
+ dependencies = ["pytest", "pytest-asyncio<1.2.0", "testlib", "workers-runtime-sdk"]
6
+
7
+ [tool.uv.sources]
8
+ testlib = { path = "../packages/testlib" }
9
+ workers-runtime-sdk = { path = "../packages/runtime-sdk" }
@@ -1,28 +1,10 @@
1
- import asyncio
2
1
  import os
3
- import sys
4
2
 
5
- import pytest
6
- from pyodide.webloop import WebLoop
3
+ from testlib.entrypoint import run_pytest
7
4
 
8
5
  import asgi
9
6
  from workers import WorkerEntrypoint
10
7
 
11
-
12
- async def noop(*args):
13
- pass
14
-
15
-
16
- # pytest-asyncio relies on these but in Pyodide < 0.29 WebLoop does not implement them
17
- WebLoop.shutdown_asyncgens = noop
18
- WebLoop.shutdown_default_executor = noop
19
-
20
- # Pyodide 0.26.0a2's _cancel_all_tasks calls task.exception() on pending tasks,
21
- # which raises InvalidStateError under Pyodide's WebLoop.
22
- if sys.version_info < (3, 13):
23
- asyncio.runners._cancel_all_tasks = lambda loop: None # type: ignore[attr-defined]
24
-
25
-
26
8
  # ---------------------------------------------------------------------------
27
9
  # ASGI apps
28
10
  # ---------------------------------------------------------------------------
@@ -291,4 +273,4 @@ class Default(WorkerEntrypoint):
291
273
  async def test(self):
292
274
  os.chdir("/session/metadata/tests")
293
275
  args = [".", "-vv"]
294
- assert pytest.main(args) == 0
276
+ run_pytest(args)
@@ -0,0 +1,9 @@
1
+ [project]
2
+ name = "test"
3
+ version = "0.0.0"
4
+ requires-python = ">=3.12"
5
+ dependencies = ["pytest", "pytest-asyncio<1.2.0", "testlib", "workers-runtime-sdk"]
6
+
7
+ [tool.uv.sources]
8
+ testlib = { path = "../packages/testlib" }
9
+ workers-runtime-sdk = { path = "../packages/runtime-sdk" }