Page MenuHomeSoftware Heritage

D648.id2032.diff
No OneTemporary

D648.id2032.diff

diff --git a/Makefile.local b/Makefile.local
--- a/Makefile.local
+++ b/Makefile.local
@@ -1,7 +1 @@
-# run only tests that do not require database setup
-test-nodb:
- $(NOSE) $(NOSEFLAGS) -a '!db'
-
-# run only tests that do require database setup
-test-db:
- $(NOSE) $(NOSEFLAGS) -a 'db'
+TESTFLAGS=--hypothesis-profile=fast
diff --git a/conftest.py b/conftest.py
new file mode 100644
--- /dev/null
+++ b/conftest.py
@@ -0,0 +1,6 @@
+from hypothesis import settings
+
+# define tests profile. Full documentation is at:
+# https://hypothesis.readthedocs.io/en/latest/settings.html#settings-profiles
+settings.register_profile("fast", max_examples=5, deadline=5000)
+settings.register_profile("slow", max_examples=20, deadline=5000)
diff --git a/swh/storage/tests/algos/test_snapshot.py b/swh/storage/tests/algos/test_snapshot.py
--- a/swh/storage/tests/algos/test_snapshot.py
+++ b/swh/storage/tests/algos/test_snapshot.py
@@ -7,7 +7,7 @@
import pytest
-from hypothesis import given, settings
+from hypothesis import given
from hypothesis.strategies import (binary, composite, datetimes, dictionaries,
from_regex, none, one_of, sampled_from)
@@ -94,6 +94,7 @@
@pytest.mark.db
+@pytest.mark.property_based
class TestSnapshotAllBranches(StorageTestFixture, unittest.TestCase):
@given(origins(), datetimes(), snapshots(min_size=0, max_size=10,
only_objects=False))
@@ -106,7 +107,6 @@
snapshot['id'])
self.assertEqual(snapshot, returned_snapshot)
- @settings(max_examples=5, deadline=5000)
@given(origins(), datetimes(),
branch_names(), branch_targets(only_objects=True))
def test_snapshot_large(self, origin, ts, branch_name, branch_target):
diff --git a/swh/storage/tests/test_storage.py b/swh/storage/tests/test_storage.py
--- a/swh/storage/tests/test_storage.py
+++ b/swh/storage/tests/test_storage.py
@@ -1846,6 +1846,7 @@
self.assertIsNotNone(o_m1)
+@pytest.mark.db
@pytest.mark.property_based
class PropBasedTestStorage(BaseTestStorage, unittest.TestCase):
def assert_contents_ok(self, expected_contents, actual_contents,
diff --git a/tox.ini b/tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -7,7 +7,7 @@
pytest-cov
pifpaf
commands =
- pifpaf run postgresql -- pytest --cov=swh --cov-branch {posargs}
+ pifpaf run postgresql -- pytest --hypothesis-profile=fast --cov=swh --cov-branch {posargs}
[testenv:flake8]
skip_install = true

File Metadata

Mime Type
text/plain
Expires
Nov 4 2024, 5:46 PM (9 w, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3229601

Event Timeline