Live API tests intermittently get results without a Result pod

Aperta
#41 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
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing

Direzione di ricerca

Start with tests/test_client.py::test_basic and test_results_iterator, then inspect the temp_result fixture and how Result.results selects pods. The issue suggests incomplete responses may report timed-out pods through @timedout or @timedoutpods, but the CI log does not confirm this. Investigate the proposed test-query timeouts and failure diagnostics; done when the intermittent failures are addressed and tests can distinguish a missing answer from a timed-out pod.

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

Descrizione

tests/test_client.py::test_basic and test_results_iterator failed intermittently in this job (3.13/ubuntu, PR #40):

FAILED tests/test_client.py::test_basic - ValueError: not enough values to unpack (expected 1, got 0)
FAILED tests/test_client.py::test_results_iterator - StopIteration

The same commit passed every job in the pull_request run.

What happened

The temp_result fixture queries '30 deg C in deg F'. Wolfram|Alpha normally sends back 8 pods (sections of the answer), including a primary Result pod (86 °F (degrees Fahrenheit)). In the failing job, the query succeeded (@success: True) but returned only 7 pods, and none of them was Result. As a result, Result.results, which selects pods that are primary or titled Result, was empty.

This is not the location dependence from #39. From US, UK, German and Japanese IP addresses, and with or without location/units, the query always returned the same 8 pods, including Result. Fifteen repeated queries from one place were also all identical.

Likely cause

Wolfram|Alpha drops pods that take too long to compute. A pod whose computation runs past scantimeout (default 3.0s) or podtimeout (default 4.0s) is left out of the response and listed in the @timedout / @timedoutpods attributes. Locally, this query reports @timing of about 3.3s, which is right at that limit. So a slightly slower moment on Wolfram|Alpha's side could plausibly drop the Result pod.

I couldn't confirm this from the CI log, because pytest truncates the fixture repr before the @timedout attribute. It is distinct from #38: there the HTTP request itself times out, while here the request succeeds but the answer is incomplete.

Possible remedies

  • Pass more generous scantimeout / podtimeout in the test queries so all pods are computed. Possibly also add a Client default, in line with the timeout work in #38.
  • When a test gets an incomplete result, include @timedout / @timedoutpods in the assertion message, so failures say why.
  • Optionally, give Result a property that exposes timed-out pods. Then users, and tests, can tell "no answer" apart from "answer timed out".
Lingua principale
Python
Stelle
154
Fork
26
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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.

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.