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.

problema test su terminale HW2 bis es 1

E
EmanueleMancini (380 points)
0 8 12
in Es1 by (380 points)
ho finito il programma… su spyder funziona, ma quando provo a lanciare i test da terminale mi da questo errore:

============================= test session starts =============================
platform win32 -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0 -- C:\Users\Emanuele\AppData\Local\Continuum\anaconda3\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\Emanuele\Downloads\Università\1 ANNO (primo semestre)\HW2bis, inifile:
plugins: timeout-1.2.1, remotedata-0.2.1, openfiles-0.3.0, doctestplus-0.1.3, arraydiff-0.2
timeout: 1.0s method: thread
collected 0 items / 1 errors

=================================== ERRORS ====================================
_________________________ ERROR collecting test_01.py _________________________
import file mismatch:
imported module 'test_01' has this __file__ attribute:
  C:\Users\Emanuele\Downloads\Università\HW2bis\test_01.py
which is not the same as the test file we want to collect:
  C:\Users\Emanuele\Downloads\Università\1 ANNO (primo semestre)\HW2bis\test_01.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.45 seconds ===========================

qualche idea?
221 views
closed

1 Answer

Best answer
K
Khalester (3310 points)
2 5 24
by (3.3k points)
selected by
Yep, prova a rimuovere __pycache__. Questo succede perché hai spostato/sostituito un programma e quando il tester cerca quel programma, vede che non è lo stesso e dà quell'errore. Spero di aver spiegato un po' il problema siccome non ricordo precisamente come accadeva.

Infatti se leggi qua:

"imported module 'test_01' has this __file__ attribute:
  C:\Users\Emanuele\Downloads\Università\HW2bis\test_01.py
which is not the same as the test file we want to collect:
  C:\Users\Emanuele\Downloads\Università\1 ANNO (primo semestre)\HW2bis\test_01.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!"