glato / emerge

Emerge is a browser-based interactive codebase and dependency visualization tool for many different programming languages. It supports some basic code quality and graph metrics and provides a simple and intuitive way to explore and analyze a codebase by using graph structures.
MIT License
783 stars 46 forks source link

Failed tests with ImportError: cannot import name 'Iterable' from 'collections' #14

Closed krotoff closed 2 years ago

krotoff commented 2 years ago

Failed tests I have failed tests on step 5.

Describe your environment

To Reproduce

  1. $git clone https://github.com/glato/emerge.git
  2. $brew install graphviz
  3. $cd emerge
  4. $pip3 install virtualenv
  5. $virtualenv -p python3 venv
  6. $source venv/bin/activate
  7. $pip install -r requirements.txt
  8. $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)
glato commented 2 years ago

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:

CleanShot 2022-02-15 at 21 24 03@2x

Will have to check this in detail in the following days. Maybe I need to implement unit tests for the unit tests 👀.

krotoff commented 2 years ago

Hello, @glato!

Recursion as it is :)

glato commented 2 years ago

@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.

krotoff commented 2 years ago

@glato glad to hear it and to help :)

glato commented 2 years ago

@krotoff Updated tabulate, unit tests and README in the current release 1.2.0 so that it should be working fine again.

krotoff commented 2 years ago

@glato thank you! Tests are working now :)