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

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

pytest -rA -v --profile test.py

B
Babby740 (1240 points)
24 35 39
in Programmare in Python by (1.2k points)
recategorized by
Sto avendo problemi nell'usare questo comando. Qualcuno può spiegarmi cosa devo fare?
535 views
closed with the note: risolto

2 Answers

edo.13 (930 points)
2 2 8
by (930 points)

nel prompt di anaconda, installa il pacchetto profiling con questo codice: --> conda install -c conda-forge pytest-profiling

successivamente per testare il tuo programma muoviti nella directory dov'è presente il tuo programma e il file test ed esegui questo comando nel prompt: --> pytest test_01.py -v -rA

B
Babby740 (1240 points)
24 35 39
by (1.2k points)
Grazie, ora funziona.
AndreaGasparini (18850 points)
7 12 120
by (18.9k points)
Quando qualcuno risolve un tuo quesito ricordati di segnare la sua risposta come "Best Answer" e di non limitarti a chiudere il post segnando risolto (anche perché segnare una risposta come best answer lo chiude in automatico)
B
Babby740 (1240 points)
24 35 39
by (1.2k points)
Si, mi sono scordato, ma non l'ho chiuso io.
E
Edward (25950 points)
4 4 172
by (26.0k points)

Hai installato pytest-profiling? (comando conda install -c conda-forge pytest-profiling da Anaconda Prompt)

Una volta installato devi andare a modificare questo file C:\Users\NomeUtente\Anaconda3\Lib\site-packages\pytest_profiling.py (se sei su windows 10)

devi mettere

pstats.Stats(self.combined, stream=terminalreporter).strip_dirs().sort_stats('tottime').print_stats(20)

al posto di

pstats.Stats(self.combined, stream=terminalreporter).strip_dirs().sort_stats('cumulative').print_stats(20)

Infine da Anaconda Prompt, spostati nella cartella dell'homework, ed usa il comando:

pytest -rA -v --profile test_01.py

Per vedere nel dettaglio i tempi di esecuzione per ogni funzione del programma.

B
Babby740 (1240 points)
24 35 39
by (1.2k points)
Grazie, ora funziona.