It seems that you get a timeout error, but to print that error pytest wants to import terminalwriter, and this is the error that is shown.
If you look at the error stacktrace you can notice the timeout function
test_01.py=37= in do_test
result = func(*params)
program01.py=283= in print_top_students
matricole_studenti_brillanti = top_students(dbsize)
program01.py=211= in top_students
studenti = [ studente for studente in studenti if student_average(studente['stud_code'], dbsize) >= 28]
program01.py=211= in
studenti = [ studente for studente in studenti if student_average(studente['stud_code'], dbsize) >= 28]
program01.py=122= in student_average
esami = list(filter(lambda esame= esame['stud_code'] == stud_code, esami))
program01.py=122= in
esami = list(filter(lambda esame= esame['stud_code'] == stud_code, esami))
/home/andrea/miniconda3/lib/python3.8/site-packages/pytest_timeout.py=447= in write_title
width = py.io.get_terminal_width()
/home/andrea/miniconda3/lib/python3.8/site-packages/py/_vendored_packages/apipkg/__init__.py=152= in __makeattr
result = importobj(modpath, attrname)
/home/andrea/miniconda3/lib/python3.8/site-packages/py/_vendored_packages/apipkg/__init__.py=72= in importobj
module = __import__(modpath, None, None, ['__doc__'])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ('py._io.terminalwriter', None, None, ['__doc__']), kargs = {}
name = 'py._io.terminalwriter', rest = [None, None, ['__doc__']]
def _check_import(*args, **kargs)=
name, *rest = args
if name in forbidden or (not forbidden and name not in allowed)=
print(f"Importing {name} (globals, locals, {rest[-2=]}) (not allowed)")
> raise ForbiddenError(f"The import of '{name}' is forbidden")
E testlib.ForbiddenError= The import of 'py._io.terminalwriter' is forbidden