diff --git a/requirements-test.txt b/requirements-test.txt --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,4 @@ -hypothesis >= 3.11.0, < 6 +hypothesis >= 3.11.0 pytest pytest-mock sqlalchemy-stubs diff --git a/swh/storage/tests/storage_tests.py b/swh/storage/tests/storage_tests.py --- a/swh/storage/tests/storage_tests.py +++ b/swh/storage/tests/storage_tests.py @@ -13,7 +13,9 @@ from typing import Any, ClassVar, Dict, Iterator, Optional import attr -from hypothesis import HealthCheck, given, settings, strategies +from hypothesis import HealthCheck +from hypothesis import __version_info__ as hypothesis_version +from hypothesis import given, settings, strategies import pytest from swh.model import from_disk @@ -43,6 +45,10 @@ round_to_milliseconds, ) +function_scoped_fixture_check = ( + [HealthCheck.function_scoped_fixture] if hypothesis_version >= (5, 49) else [] +) + def transform_entries( storage: StorageInterface, dir_: Directory, *, prefix: bytes = b"" @@ -424,7 +430,10 @@ assert missing == [cont2.hashes()] @pytest.mark.property_based - @settings(deadline=None) # this test is very slow + @settings( + deadline=None, # this test is very slow + suppress_health_check=function_scoped_fixture_check, + ) @given( strategies.sets( elements=strategies.sampled_from(["sha256", "sha1_git", "blake2s256"]), @@ -455,6 +464,7 @@ ) == set(missing_per_hash[hash]) @pytest.mark.property_based + @settings(suppress_health_check=function_scoped_fixture_check,) @given( strategies.sets( elements=strategies.sampled_from(["sha256", "sha1_git", "blake2s256"]), @@ -3951,7 +3961,9 @@ ) assert swh_storage.origin_count("github", regexp=True, with_visit=True) == 1 - @settings(suppress_health_check=[HealthCheck.too_slow]) + @settings( + suppress_health_check=[HealthCheck.too_slow] + function_scoped_fixture_check, + ) @given(strategies.lists(objects(split_content=True), max_size=2)) def test_add_arbitrary(self, swh_storage, objects): for (obj_type, obj) in objects: