GoogleCloudPlatform / GoogleCloudPlatform/appengine-python-standard

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

Ouverte
#66 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
86
Forks
61
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## 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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.