Skip to content

Commit dbf4631

Browse files
committed
fix: skip property tests if hypothesis not installed
1 parent 1da5022 commit dbf4631

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_properties.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import tempfile
22
from pathlib import Path
33

4+
import pytest
45
import yaml
6+
7+
pytest.importorskip("hypothesis")
8+
59
from hypothesis import given, settings
610
from hypothesis import strategies as st
711

@@ -16,6 +20,8 @@
1620
max_size=30,
1721
)
1822

23+
pattern_text = st.text(min_size=0, max_size=50).filter(lambda x: "\n" not in x and "\r" not in x)
24+
1925

2026
@given(st.text(max_size=5000))
2127
@settings(max_examples=100)
@@ -45,9 +51,6 @@ def test_text_file_not_detected_as_binary(data):
4551
assert _is_binary_file(f) is False
4652

4753

48-
pattern_text = st.text(min_size=0, max_size=50).filter(lambda x: "\n" not in x and "\r" not in x)
49-
50-
5154
@given(st.lists(pattern_text, min_size=0, max_size=20))
5255
@settings(max_examples=100)
5356
def test_ignore_patterns_roundtrip(patterns):

0 commit comments

Comments
 (0)