Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.10 AttributeError: module 'collections' has no attribute 'Iterable' #3

Closed
jeffbr13 opened this issue Sep 29, 2022 · 1 comment · Fixed by #4
Closed

Python 3.10 AttributeError: module 'collections' has no attribute 'Iterable' #3

jeffbr13 opened this issue Sep 29, 2022 · 1 comment · Fixed by #4

Comments

@jeffbr13
Copy link
Contributor

jeffbr13 commented Sep 29, 2022

Hi there! Just thought I'd let you know that the deprecated abstract base classes aliases were removed in Python 3.10 (change) and this is causing an AttributeError wherever collections.Iterable etc. are used.

======================================================== ERRORS ========================================================
__________________________________ ERROR collecting tests/test_import_csv_to_graph.py __________________________________
tests/test_import_csv_to_graph.py:8: in <module>
    from hypothesis_csv.strategies import csv as csv_strategy
../../../../Library/Caches/pypoetry/virtualenvs/my-app-HgQtD8X_-py3.10/lib/python3.10/site-packages/hypothesis_csv/strategies.py:1: in <module>
    from hypothesis_csv import _csv
../../../../Library/Caches/pypoetry/virtualenvs/my-app-HgQtD8X_-py3.10/lib/python3.10/site-packages/hypothesis_csv/_csv.py:6: in <module>
    from hypothesis_csv._data_rows import *
../../../../Library/Caches/pypoetry/virtualenvs/my-app-HgQtD8X_-py3.10/lib/python3.10/site-packages/hypothesis_csv/_data_rows.py:21: in <module>
    def get_columns(draw, columns: isa(collections.Iterable)):
E   AttributeError: module 'collections' has no attribute 'Iterable'
=============================================== short test summary info ================================================
ERROR tests/test_import_csv_to_graph.py - AttributeError: module 'collections' has no attribute 'Iterable'

The fix is to replace collections.Iterable and similar lookups with collections.abc.….

@jeffbr13
Copy link
Contributor Author

I've provided PR #4 which fixes this issue.

chobeat pushed a commit that referenced this issue Jan 22, 2024
* Fix #3 by importing collections.abc.Iterable

Fixes compatibility with Python 3.10 by changing references to the
deprecated and now removed collections.Iterable alias
to collections.abc.Iterable.

* Remove hypothesis.Settings(use_coverage=…) decorator.

The hypothesis.Settings(use_coverage=…) setting was removed in
Hypothesis 4.0.0:
<https://hypothesis.readthedocs.io/en/latest/changes.html?highlight=use_coverage#settings>

* Increase length of test CSV to better detect column type in tests

* Removed unused import of `hypothesis.settings`

* Only require meza for testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant