Apply suggestions from code review
The commited suggestions will restore compatibility with Python 3.6.
Co-authored-by: Christian Clauss <cclauss@me.com>
diff --git a/test_mccabe.py b/test_mccabe.py
index b844518..fe6e8d3 100644
--- a/test_mccabe.py
+++ b/test_mccabe.py
@@ -7,8 +7,11 @@
from io import StringIO
import pytest
-import hypothesmith
-from hypothesis import HealthCheck, given, settings, strategies as st
+try:
+ import hypothesmith
+ from hypothesis import HealthCheck, given, settings, strategies as st
+except ImportError:
+ hypothesmith = None
import mccabe
from mccabe import get_code_complexity
@@ -251,6 +254,7 @@
src_contents=hypothesmith.from_grammar() | hypothesmith.from_node(),
max_complexity=st.integers(min_value=1),
)
+@pytest.mark.skipif(not hypothesmith, reason="hypothesmith could not be imported")
def test_idempotent_any_syntatically_valid_python(
src_contents: str, max_complexity: int
) -> None:
diff --git a/tox.ini b/tox.ini
index 0ea8c13..4a42088 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,8 +5,8 @@
[testenv]
deps =
pytest
- hypothesis
- hypothesmith
+ hypothesis ; python_version >= "3.6"
+ hypothesmith ; python_version >= "3.6"
commands =
pytest