Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9312395
D1943.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D1943.diff
View Options
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
@@ -11,7 +11,6 @@
from collections import defaultdict
from unittest.mock import Mock, patch
-import psycopg2.errors
import pytest
from hypothesis import given, strategies, settings, HealthCheck
@@ -594,7 +593,9 @@
self.assertEqual(journal_objects,
[('content', expected_cont)])
+ @pytest.mark.db
def test_content_add_validation(self):
+ import psycopg2.errors
cont = self.cont
with self.assertRaisesRegex(ValueError, 'status'):
@@ -1007,7 +1008,9 @@
after_missing = list(self.storage.directory_missing([self.dir['id']]))
self.assertEqual([], after_missing)
+ @pytest.mark.db
def test_directory_add_validation(self):
+ import psycopg2.errors
dir_ = copy.deepcopy(self.dir)
dir_['entries'][0]['type'] = 'foobar'
@@ -1173,7 +1176,9 @@
actual_result = self.storage.revision_add([self.revision])
self.assertEqual(actual_result, {'revision:add': 0})
+ @pytest.mark.db
def test_revision_add_validation(self):
+ import psycopg2.errors
rev = copy.deepcopy(self.revision)
rev['date']['offset'] = 2**16
@@ -1355,7 +1360,9 @@
self.assertEqual(list(self.journal_writer.objects),
[('release', release)])
+ @pytest.mark.db
def test_release_add_validation(self):
+ import psycopg2.errors
rel = copy.deepcopy(self.release)
rel['date']['offset'] = 2**16
@@ -1769,7 +1776,9 @@
('origin_visit', data1),
('origin_visit', data2)])
+ @pytest.mark.db
def test_origin_visit_add_validation(self):
+ import psycopg2.errors
origin_id_or_url = self.storage.origin_add_one(self.origin2)
with self.assertRaises((TypeError, psycopg2.errors.UndefinedFunction)):
@@ -1931,7 +1940,9 @@
('origin_visit', data4),
('origin_visit', data5)])
+ @pytest.mark.db
def test_origin_visit_update_validation(self):
+ import psycopg2.errors
origin_id = self.storage.origin_add_one(self.origin)
visit = self.storage.origin_visit_add(
origin_id,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 2, 10:51 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3223226
Attached To
D1943: test_storage: Sandbox psycopg2.errors import instruction where needed
Event Timeline
Log In to Comment