GoogleCloudPlatform / GoogleCloudPlatform/appengine-python-standard

os.environ not passed through Flask test_client() after Flask app been wrapped by wrap_wsgi_app()

オープン
#66 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。