Failed tests with ImportError: cannot import name 'Iterable' from 'collections'
krotoff opened this issue · 6 comments
Failed tests
I have failed tests on step 5.
Describe your environment
- MacOS 12.0.1 Monterrey
- Python 3.10.2
- Google Chrome 94.0.4606.81
- Branch dev/1.1.0
To Reproduce
- $git clone https://github.com/glato/emerge.git
- $brew install graphviz
- $cd emerge
- $pip3 install virtualenv
- $virtualenv -p python3 venv
- $source venv/bin/activate
- $pip install -r requirements.txt
- $python emerge/tests/run_tests.py
Expected behavior
Successful tests
Reality
Traceback (most recent call last):
File "/Users/akrotov/Downloads/emerge/emerge/tests/run_tests.py", line 9, in <module>
from interrogate import coverage
File "/Users/akrotov/Downloads/emerge/venv/lib/python3.10/site-packages/interrogate/coverage.py", line 10, in <module>
import tabulate
File "/Users/akrotov/Downloads/emerge/venv/lib/python3.10/site-packages/tabulate.py", line 16, in <module>
from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)
Hi @krotoff 👋, thanks for the feedback. You seem to be right. As a matter of fact, I was able to solve this first issue by simply upgrading tabulate:
pip install tabulate==0.8.9 -U
since there seems to be a bug related to python 3.10, but unfortunately another issue came up. It seems there is a problem with the current import module structure when executing the unit tests from the command line. The interesting part is, this seems to work pretty fine by using test discovery and execution within vscode:
Will have to check this in detail in the following days. Maybe I need to implement unit tests for the unit tests 👀.
@krotoff Had the time to figure out, how to manually get the tests running from the command line again. While in the project root directory, simply do a
python -m unittest discover -v -s ./emerge -p "test_*.py"
This should hopefully start and run all present tests and give an output that ends similar to
Ran 21 tests in 1.046s
OK
I will update requirements.txt and setup.py to match tabulate 0.8.9, update the README and adjust run_tests.py in the next release. Will make a small README update before the next release that mentions the command line version.
Thanks again for the hint.