Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9346420
D3148.id11176.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
D3148.id11176.diff
View Options
diff --git a/swh/journal/tests/journal_data.py b/swh/journal/tests/journal_data.py
--- a/swh/journal/tests/journal_data.py
+++ b/swh/journal/tests/journal_data.py
@@ -5,12 +5,36 @@
import datetime
-from typing import Any, Dict, List
+from typing import Any, Dict, List, Type
from swh.model.hashutil import MultiHash, hash_to_bytes
from swh.journal.serializers import ModelObject
-from swh.journal.writer.kafka import OBJECT_TYPES
+from swh.model.model import (
+ BaseModel,
+ Content,
+ Directory,
+ Origin,
+ OriginVisit,
+ Release,
+ Revision,
+ SkippedContent,
+ Snapshot,
+)
+
+
+OBJECT_TYPES: Dict[Type[BaseModel], str] = {
+ Content: "content",
+ Directory: "directory",
+ Origin: "origin",
+ OriginVisit: "origin_visit",
+ Release: "release",
+ Revision: "revision",
+ SkippedContent: "skipped_content",
+ Snapshot: "snapshot",
+}
+
+UTC = datetime.timezone.utc
CONTENTS = [
{**MultiHash.from_data(b"foo").digest(), "length": 3, "status": "visible",},
@@ -146,7 +170,7 @@
if object_type == "origin_visit":
obj_d = {**obj_d, "visit": num}
elif object_type == "content":
- obj_d = {**obj_d, "data": b"", "ctime": datetime.datetime.now()}
+ obj_d = {**obj_d, "data": b"", "ctime": datetime.datetime.now(tz=UTC)}
converted_objects.append(model.from_dict(obj_d))
diff --git a/swh/journal/writer/kafka.py b/swh/journal/writer/kafka.py
--- a/swh/journal/writer/kafka.py
+++ b/swh/journal/writer/kafka.py
@@ -9,18 +9,6 @@
from confluent_kafka import Producer, KafkaException
-from swh.model.model import (
- BaseModel,
- Content,
- Directory,
- Origin,
- OriginVisit,
- Release,
- Revision,
- SkippedContent,
- Snapshot,
-)
-
from swh.journal.serializers import (
KeyType,
ModelObject,
@@ -32,17 +20,6 @@
logger = logging.getLogger(__name__)
-OBJECT_TYPES: Dict[Type[BaseModel], str] = {
- Content: "content",
- Directory: "directory",
- Origin: "origin",
- OriginVisit: "origin_visit",
- Release: "release",
- Revision: "revision",
- SkippedContent: "skipped_content",
- Snapshot: "snapshot",
-}
-
class DeliveryTag(NamedTuple):
"""Unique tag allowing us to check for a message delivery"""
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 4:00 PM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221849
Attached To
D3148: Fix test data: only create aware datetime objects
Event Timeline
Log In to Comment