Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Quart test client does not support same "data" arguments as Flask / Werkzeug

Aperta
#353 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend, testing

Direzione di ricerca

Inizia in quart/testing/utils.py, nella gestione dei dati del client di test, quindi confrontala con il comportamento del client Werkzeug collegato. Il lavoro è completato quando il client accetta dizionari simili a form, inclusi i dati dei file, e produce una richiesta che il server può analizzare per l'esempio fornito.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When migrating from Flask to Quart, one of the issues I ran into was that Werkzeug's client supports more in the data field. This input supports having a dict passed in which will encode it to a form and also allows values to be file data. If you look at Quart's test client, it only accepts pre-formatted data fields. It doesn't support passing in form-like data which is encoded. This is much less flexible than Flask / Werkzeug allowed and is making porting hundreds of tests a headache for this Flask project.

Here's an example of a snippet of tests:

async with aiofiles.open(filename, 'rb') as f:
    data = {
        'file_mapping': 'custom',
        'xlsx_file': (io.BytesIO(await f.read()), 'spreadsheet.xlsx')
    }

    res = await client.post(
        url_for("import_page"),
        data=data,
        follow_redirects=True,
    )

In Quart this results in something that is not parseable on the server side.

Lingua principale
Python
Stelle
3.7k
Fork
206
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pallets/quart

Tutte le issue di pallets/quart

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.