Skip to content

fix: align WSGI/ASGI test infrastructure and handler with spec - #1513

Merged
WilliamBergamin merged 9 commits into
mainfrom
imporve-asgi-wsgi-remove-deps
Jun 2, 2026
Merged

fix: align WSGI/ASGI test infrastructure and handler with spec#1513
WilliamBergamin merged 9 commits into
mainfrom
imporve-asgi-wsgi-remove-deps

Conversation

@WilliamBergamin

Copy link
Copy Markdown
Contributor

Summary

Use stdlib wsgiref.validate and asgiref.testing to ensure test servers are fully PEP 3333 / ASGI spec-compliant.

This also removes dependencies we were not using, and audit the implementation of the WSGI and ASGI adapters

Testing

Continuous integration pipeline should be sufficient

If you want to test it out locally

# requirements.txt
pytest==9.0.3
ruff==0.15.12
uvicorn[standard]
aiohttp
path/to/bolt-python/dist/slack_bolt-1.28.0-py2.py3-none-any.whl
slack-cli-hooks<1.0.0
importosimportloggingfromslack_bolt.async_appimportAsyncAppfromslack_bolt.adapter.asgi.async_handlerimportAsyncSlackRequestHandlerlogging.basicConfig(level=logging.DEBUG)
app=AsyncApp(
token=os.environ.get("SLACK_BOT_TOKEN"),
signing_secret="your signing secret",
)
@app.event("app_home_opened")asyncdefapp_home_opened(client, event, logger):
ifevent["tab"] !="home":
returntry:
awaitclient.views_publish(
user_id=event["user"],
view={
"type": "home",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Welcome home, <@"+event["user"] +"> :house:*",
},
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Learn how home tabs can be more useful and "+"interactive <https://api.slack.com/surfaces/tabs/using|*in the documentation*>.",
},
},
],
},
)
exceptExceptionase:
logger.error(f"Error publishing home tab: {e}")
api=AsyncSlackRequestHandler(app)
{
"_metadata": {
"major_version": 1,
"minor_version": 1
},
"display_information": {
"name": "test-asgi-adapter"
},
"features": {
"app_home": {
"home_tab_enabled": true,
"messages_tab_enabled": false,
"messages_tab_read_only_enabled": true
},
"bot_user": {
"display_name": "test-asgi-adapter",
"always_online": false
}
},
"oauth_config": {
"scopes": {
"bot": [
"chat:write"
]
}
},
"settings": {
"event_subscriptions": {
"bot_events": [
"app_home_opened"
]
},
"interactivity": {
"is_enabled": false
},
"org_deploy_enabled": true,
"socket_mode_enabled": false,
"token_rotation_enabled": false
}
}
uvicorn app:api --port 3000 --log-level trace

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@WilliamBergaminWilliamBergamin added this to the 1.29.0 milestone May 29, 2026
@WilliamBergaminWilliamBergamin self-assigned this May 29, 2026
@WilliamBergamin
WilliamBergamin requested a review from a team as a code ownerMay 29, 2026 22:02
@WilliamBergaminWilliamBergamin added area:adapter dependencies Pull requests that update a dependency file tests semver:patch labels May 29, 2026
@codecov

codecovBot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.34%. Comparing base (a38510f) to head (75858cc).
✅ All tests successful. No failed tests found.

Files with missing linesPatch %Lines
slack_bolt/adapter/asgi/http_response.py85.71%1 Missing ⚠️
slack_bolt/adapter/wsgi/handler.py80.00%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #1513 +/- ##
==========================================
- Coverage 91.36% 91.34% -0.03% 
==========================================
Files 228 228 Lines 7275 7279 +4 ==========================================
+ Hits 6647 6649 +2 - Misses 628 630 +2 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zimegzimeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@WilliamBergamin Another much appreciated enhancement to maintained packages 🎁

starlette>=0.49.3,<1; python_version>="3.9"
tornado>=6.2,<7; python_version<"3.9"
tornado>=6.5.6,<7; python_version>="3.9"
uvicorn<1 # The oldest version can vary among Python runtime versions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🐍 praise: Thank you for keeping this minimal!

Comment on lines +76 to +77
environ: "WSGIEnvironment",
start_response: "StartResponse",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🪬 praise: Super meaningful improvement to building with confidence!

@WilliamBergamin
WilliamBergamin merged commit e48100f into mainJun 2, 2026
16 checks passed
@WilliamBergamin
WilliamBergamin deleted the imporve-asgi-wsgi-remove-deps branch June 2, 2026 16:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:adapterdependenciesPull requests that update a dependency filesemver:patchtests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@WilliamBergamin@zimeg