Make test "time module error"
Closed this issue · 3 comments
Hi, im running on Ubuntu 22.04, Python version 3.8.18. I've installed everything, "make" command runs, "make install" runs without error.
When i run "make test" i get the following error:
_________________________________ ERROR collecting charm/schemes/abenc/abenc_yct14.py __________________________________
ImportError while importing test module '/home/lorenzo/charm/charm/schemes/abenc/abenc_yct14.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.8/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
charm/schemes/abenc/abenc_yct14.py:22: in
from time import clock
E ImportError: cannot import name 'clock' from 'time' (unknown location)
=============================================== short test summary info ================================================
ERROR charm/schemes/abenc/abenc_yct14.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Also in VSCode when I type "from charm." i can see only some options like build, conftest,doc, embed but not all the module that i need to create schemes.
Some helps please?
Thanks
The issue is with the following import statement on line 22 of the file charm/schemes/abenc/abenc_yct14.py.
from time import clock
The function clock()
was removed from Python versions 3.8 and above.
Use the following import statement instead and replace all occurrences of clock()
with time()
.
from time import time
Solved
Would you mind submitting a PR with the fix for others?