Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Code coverage

andrea.sterbini (207940 points)
756 1270 2377
in Programmare in Python by (208k points)
edited by

Per permettervi di controllare se qualche parte del vostro codice non è stata eseguita dai test, e va controllata a mano, nei prossimi HW aggiungerò nel log di correttezza, la misura della code coverage del programma testato.

Per il momento potete fare questo controllo in locale:

  • installate il plugin pytest-cov (conda install pytest-cov)
  • eseguite i test col plugin attivato ( pytest test_01.py --cov=program01 --cov-report=html )
  • visualizzate il report (firefox htmlcov/index.html)
  • le righe marcate di rosso non sono state eseguite da nessun test e vanno controllate a mano (potrebbero essere eseguite in altri test)

1 Answer

S
S3b4stian82 (2250 points)
5 6 27
by (2.3k points)
Prof.

Se potesse aggiungere anche quanta memoria utilizza lo script in esecuzione, sarebbe interessate!
andrea.sterbini (207940 points)
756 1270 2377
by (208k points)

Per quello c'è pytest-memprof (pip install pytest-memprof)

Si usa aggiungendo a pytest il parametro --memprof-top-n=<numero di voci da mostrare>

Non credo che lo aggiungerò, che non do nessun bonus per chi usa meno memoria.

Inoltre le stime che fa sono molto molto variabili.

S
S3b4stian82 (2250 points)
5 6 27
by (2.3k points)
Perfetto, grazie!