Skip to content

Fix optional hypothesmith import on Python 3.14#118

Open
l46983284-cpu wants to merge 1 commit into
PyCQA:masterfrom
l46983284-cpu:fix-113-hypothesmith-optional-on-314
Open

Fix optional hypothesmith import on Python 3.14#118
l46983284-cpu wants to merge 1 commit into
PyCQA:masterfrom
l46983284-cpu:fix-113-hypothesmith-optional-on-314

Conversation

@l46983284-cpu

Copy link
Copy Markdown

On Python 3.14, an installed but incompatible hypothesis/hypothesmith can raise AttributeError during import (typing.ByteString was removed). That still failed collection of the whole test_mccabe.py module.

#117 already made the fuzz test optional when those packages are missing (ImportError). This follows that pattern and treats any import-time failure the same way: set hypothesmith = None so the existing stub skips the optional fuzz test and the rest of the suite still runs.

Test plan

  • python3 -m pytest -q -k 'not test_get_module_complexity' test_mccabe.py → 14 passed, 1 skipped
  • Simulated broken import (AttributeError on hypothesmith/hypothesis) → guard sets hypothesmith is None
  • Full suite still shows the pre-existing test_get_module_complexity flake (unrelated C901 path); not part of this change

Fixes #113

Catch any Exception when importing hypothesis/hypothesmith so a
broken optional dependency (e.g. typing.ByteString removed on 3.14)
skips the fuzz test instead of failing collection.

Fixes PyCQA#113

Signed-off-by: Alex Chen <l46983284@gmail.com>
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 this pull request may close these issues.

Test failure on 3.14

1 participant