Skip to content

Commit 339e17f

Browse files
author
Tom Softreck
committed
moved tests to the tests repo
1 parent 03f228e commit 339e17f

File tree

14 files changed

+12
-726
lines changed

14 files changed

+12
-726
lines changed

src/dialogchain/connectors.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
import smtplib
44
import aiohttp
55
import cv2
6+
import os
7+
import logging
68
from abc import ABC, abstractmethod
79
from typing import AsyncIterator, Any, Dict
810
from urllib.parse import urlparse, parse_qs
911
from email.mime.text import MIMEText
1012
from email.mime.multipart import MIMEMultipart
1113
from datetime import datetime
12-
import logging
1314

1415

1516
class Source(ABC):
@@ -280,10 +281,10 @@ class LogDestination(Destination):
280281

281282
def __init__(self, uri: str):
282283
parsed = urlparse(uri)
283-
# Remove leading slash from path if present
284-
self.log_file = parsed.path.lstrip('/') if parsed.path else None
285-
if self.log_file == '':
286-
self.log_file = None
284+
# For URIs like 'log://test.log', the path is in netloc
285+
self.log_file = parsed.netloc if parsed.netloc else parsed.path.strip('/')
286+
# If both netloc and path are empty, set to None
287+
self.log_file = self.log_file if self.log_file else None
287288

288289
async def send(self, message: Any) -> None:
289290
"""Log message to console and optionally to a file"""

src/dialogchain/engine.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ def __init__(self, config: Dict[str, Any], verbose: bool = False):
4747
self.verbose = verbose
4848
self.routes = config.get('routes', [])
4949
self.running_processes = {}
50+
51+
# Validate the configuration on initialization
52+
errors = self.validate_config()
53+
if errors:
54+
error_msg = "Invalid configuration:\n" + "\n".join(f"- {error}" for error in errors)
55+
raise ValueError(error_msg)
5056

5157
def log(self, message: str):
5258
if self.verbose:

tests/unit/__init__.py

Whitespace-only changes.

tests/unit/api/__init__.py

Whitespace-only changes.

tests/unit/config/__init__.py

Whitespace-only changes.

tests/unit/connectors/__init__.py

Whitespace-only changes.

tests/unit/connectors/test_connectors.py

Lines changed: 0 additions & 60 deletions
This file was deleted.

tests/unit/core/__init__.py

Whitespace-only changes.

tests/unit/core/test_engine.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/unit/core/test_processors.py

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)