Mi da questo errore quando provo i test nel prompt. Su spider ovviamente funziona.

Hatlas (5340 points)
1 2 7
asked Oct 28, 2020 in HW2 obbligatorio by Hatlas (5,340 points)
closed Oct 28, 2020 by andrea.sterbini

FAILED test_01.py::Test::test_example - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00001_test_200_4_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00002_test_400_5_ita - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00003_test_600_6_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00004_test_800_7_ita - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00005_test_1000_8_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00006_test_1200_9_ita - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00007_test_1400_10_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00008_test_1600_11_ita - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00009_test_2000_12_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json1_00010_test_10000_10_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json2_00001_test_100000_12_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json2_00002_test_100000_12_ita - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json3_00001_test_500000_15_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json3_00002_test_500000_15_ita - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json4_00001_test_1000000_15_ita - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
FAILED test_01.py::Test::test_json4_00002_test_1000000_15_eng - testlib.ForbiddenError: The import of 'unicodedata' is forbidden
========================================================================= 17 failed, 2 warnings in 13.25s =========================================================================

263 views
closed with note: risolto

2 Answers

S
Simone_Argento01 (1150 points)
0 0 6
answered Oct 28, 2020 by Simone_Argento01 (1,150 points)

È come se python non riuscisse ad importare il sistema di codifica. Se stai utilizzando anaconda prompt in windows prova le seguenti operazioni:

  1. Apri anaconda prompt come amministratore e prova a rieseguire il test
  2. Se ancora non ti funziona, importa all'interno del codice di test_01.py il modulo unicodedata nel seguente modo: import unicodedata
  3. Avvia nuovamente anaconda prompt come amministratore e riesegui il test.
Se questi 3 passaggi non hanno funzionato prova a disinstallare la libreria testlib ed a reinstallarla da anaconda prompt.
Hatlas (5340 points)
1 2 7
commented Oct 28, 2020 by Hatlas (5,340 points)
edited Oct 28, 2020 by Hatlas
Grazie, funziona.
andrea.sterbini (172780 points)
513 935 1789
answered Oct 28, 2020 by andrea.sterbini (172,780 points)
Non ho provato testlib su windows, per adesso disattivate timeout e controlli settando DEBUG=True in test_01.py

Poi se necessario pubblicherò un test_01.py nuovo
Hatlas (5340 points)
1 2 7
commented Oct 28, 2020 by Hatlas (5,340 points)
In test_01.py è già settato DEBUG=True e anche DEBUG=False.
Romitoskj (8920 points)
4 8 40
commented Oct 28, 2020 by Romitoskj (8,920 points)
Appunto, leva o commenta il la riga del false.
Hatlas (5340 points)
1 2 7
commented Oct 28, 2020 by Hatlas (5,340 points)
L'avevo già provato senza aver prima disinstallato e reinstallato testlib, ora l'ho fatto e funziona. Grazie a tutti.