Fix handling missing hypothesmith gracefully
Fix test_mccabe not to fail to import if hypothesmith is not available. While the original code seems to attempt to handle missing hypothesmith, the file fails with NameError without it. This is because hypothesis decorators are used in global scope. Guard the whole test function to be defined only when hypothesmith is available.
Ping.
0e24f74 fixes build of 0.7 on macOS for py37-310.
instead I'd recommend including hypothesis in your build
instead I'd recommend including hypothesis in your build
Hello. Would you accept another PR that removes the try-except around hypothesis import? Currently, whenever hypothesis or hypothesmith fails to import, the traceback is very misleading. E.g. instead of:
>>> import hypothesmith
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
import hypothesmith
File "/usr/lib/python3.13/site-packages/hypothesmith/__init__.py", line 3, in <module>
from hypothesmith.cst import from_node
File "/usr/lib/python3.13/site-packages/hypothesmith/cst.py", line 24, in <module>
from .syntactic import ALLOWED_CHARS
File "/usr/lib/python3.13/site-packages/hypothesmith/syntactic.py", line 7, in <module>
from importlib.resources import read_text
ImportError: cannot import name 'read_text' from 'importlib.resources' (/usr/lib64/python3.13/importlib/resources/__init__.py)
We see:
...
test_mccabe.py:244: in <module>
@settings(
E NameError: name 'settings' is not defined