3 pytest errors
yangleir opened this issue · 2 comments
Hi, all
I just installed the swot simulator and run the pytest
. Three errors were found:
(base) lei@lei-Abelard:~/swot_simu/swot_simulator$ pytest
============================= test session starts ==============================
platform linux -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/lei/swot_simu/swot_simulator
collected 0 items / 3 errors
==================================== ERRORS ====================================
_______________ ERROR collecting tests/test_error_generation.py ________________
ImportError while importing test module '/home/lei/swot_simu/swot_simulator/tests/test_error_generation.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../miniconda3/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_error_generation.py:4: in <module>
import swot_simulator
swot_simulator/__init__.py:12: in <module>
from . import version
E ImportError: cannot import name 'version' from partially initialized module 'swot_simulator' (most likely due to a circular import) (/home/lei/swot_simu/swot_simulator/swot_simulator/__init__.py)
___________________ ERROR collecting tests/test_launcher.py ____________________
ImportError while importing test module '/home/lei/swot_simu/swot_simulator/tests/test_launcher.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../miniconda3/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_launcher.py:4: in <module>
import swot_simulator
swot_simulator/__init__.py:12: in <module>
from . import version
E ImportError: cannot import name 'version' from partially initialized module 'swot_simulator' (most likely due to a circular import) (/home/lei/swot_simu/swot_simulator/swot_simulator/__init__.py)
_________________ ERROR collecting tests/test_random_signal.py _________________
ImportError while importing test module '/home/lei/swot_simu/swot_simulator/tests/test_random_signal.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../miniconda3/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_random_signal.py:6: in <module>
import swot_simulator
swot_simulator/__init__.py:12: in <module>
from . import version
E ImportError: cannot import name 'version' from partially initialized module 'swot_simulator' (most likely due to a circular import) (/home/lei/swot_simu/swot_simulator/swot_simulator/__init__.py)
=========================== short test summary info ============================
ERROR tests/test_error_generation.py
ERROR tests/test_launcher.py
ERROR tests/test_random_signal.py
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 3 errors in 53.69s ==============================
(base) lei@lei-Abelard:~/swot_simu/swot_simulator$
I also tried this on Windows system and the errors are the same.
Can these error be neglected?
Thanks
Lei
If you run the code from a git clone, you have to run the setup.py
script to initialize the version.py
file. This file is built automatically to deduce the version used by the simulator.
Frédéric BRIOL,
Thanks very much.
I misunderstood the root directory of the swot_simulator repository
in the installation instruction. I installed the simulator by conda. But test it in the git repository.
Maybe, the root directory means that in conda environment. Like \miniconda3\Lib\site-packages\swot_simulator
.
However, there is no tests
in \miniconda3\Lib\site-packages\swot_simulator
. I simply copy tests
directory from git repository to conda environment and run pytest
again. Then everything is ok.
Or, like your comments. Install the swot_simulator from resource by python setup.py install
. Then run pytest
. It is also works fine.