GoogleCloudPlatform / GoogleCloudPlatform/appengine-python-standard
os.environ not passed through Flask test_client() after Flask app been wrapped by wrap_wsgi_app()
- 主要语言
- Python
- 星标
- 86
- 派生
- 61
- PR 合并指标
- 30 天内没有已合并 PR
描述
## Expected Behavior
```
ID1 before test_client(): 123
ID2 before test_client(): 456
APPLICATION_ID after test_client(): testbed-test
ID1 after test_client(): 123
ID2 after test_client(): 456
APPLICATION_ID after test_client(): testbed-test
```
## Actual Behavior
```
ID1 before test_client(): 123
ID2 before test_client(): 456
APPLICATION_ID after test_client(): testbed-test
ID1 after test_client(): 123
ID2 after test_client():
APPLICATION_ID after test_client():
```
## Steps to Reproduce the Problem
1. Run the following code with Python 3
```
from flask import Flask
from google.appengine.api import wrap_wsgi_app
from google.appengine.ext import testbed
import os
os.environ['ID1'] = "123"
app = Flask(__name__)
app.wsgi_app = wrap_wsgi_app(app.wsgi_app)
os.environ['ID2'] = "456"
@app.route('/')
def hello():
print("ID1 after test_client(): %s" % os.environ.get("ID1", ""))
print("ID2 after test_client(): %s" % os.environ.get("ID2", ""))
print("APPLICATION_ID after test_client(): %s" % os.environ.get("APPLICATION_ID", ""))
return "OK"
t = testbed.Testbed()
t.activate()
t.setup_env()
print("ID1 before test_client(): %s" % os.environ.get("ID1", ""))
print("ID2 before test_client(): %s" % os.environ.get("ID2", ""))
print("APPLICATION_ID after test_client(): %s" % os.environ.get("APPLICATION_ID", ""))
app.test_client().get('/')
```
## Specifications
- Version: appengine-python-standard 1.0.0
- Platform: Python 3.9
贡献指南
评估
这个 Issue 还没有评估数据。