Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
¿Por qué no obtener una cobertura del 100 % en FastAPI con pytest-cov usando starlettes TestClient?

Simplemente no entiendo el resultado de pytest-cov

ingrese la descripción de la imagen aquí

Mi módulo de prueba es el siguiente

 from starlette.testclient import TestClient def test_ping(test_app: TestClient): response = test_app.get("/ping") assert response.status_code == 200 assert response.json() == {"environment": "dev", "ping": "pong!", "testing": True}

Es decir no entiendo el 1 parcial y el 1 faltante. El informe completo de CLI:

 ❯ docker-compose exec web coverage report -m Name Stmts Miss Branch BrPart Cover Missing -------------------------------------------------------------------- app/__init__.py 0 0 0 0 100% app/api/__init__.py 0 0 0 0 100% app/api/crud.py 14 0 2 0 100% app/api/ping.py 7 1 2 1 78% 267, 10->9 app/api/summaries.py 20 0 8 5 82% 12->11, 12->19, 19->18, 19->24, 24->23 app/config.py 12 0 2 1 93% 16->15 app/db_init.py 8 1 0 0 88% 268 app/main.py 19 2 4 3 78% 270-274, 25->24, 25->31, 31->30 app/models/__init__.py 0 0 0 0 100% app/models/pydantic.py 5 0 0 0 100% app/models/tortoise.py 9 1 0 0 89% 11 db_generate_schema.py 13 13 2 0 0% 1-274 -------------------------------------------------------------------- TOTAL 107 18 20 10 76%

En primer lugar, me gustaría entender los 267, 10->9 que faltan: ni siquiera tengo más de 15 líneas en ese archivo. Eso probablemente explicaría los problemas restantes también.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

tal vez de alguna manera está conectado con mi problema

cuando se pierde líneas al azar

la cobertura de pytest salta algunas líneas

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!