style: ruff format (new quality gate check picked up from main)

This commit is contained in:
PedroHMCosme
2026-09-22 11:29:41 -03:00
parent 0d20f6d123
commit 79258658bc
3 changed files with 37 additions and 15 deletions

View File

@@ -72,7 +72,9 @@ class GatewayRuntime(SientiaMonitoring):
bucket=config.cert_bucket, bucket=config.cert_bucket,
metadata=self.metadata, metadata=self.metadata,
) )
self.pool = OpcConnectionPool(cert_provider, logger, notification_handler, metrics_controller) self.pool = OpcConnectionPool(
cert_provider, logger, notification_handler, metrics_controller
)
postgres = Postgres( postgres = Postgres(
**build_postgres_config(), **build_postgres_config(),

View File

@@ -3,9 +3,17 @@ import pytest
from ingestor.config import GatewayConfig from ingestor.config import GatewayConfig
_ENV_VARS = ( _ENV_VARS = (
'NATS_URL', 'NATS_WRITE_SUBJECT', 'NATS_QUEUE', 'GRPC_ENABLED', 'GRPC_PORT', 'NATS_URL',
'CERT_BUCKET', 'CERT_CACHE_DIR', 'WRITE_TIMESTAMP', 'WRITE_QUALITY', 'NATS_WRITE_SUBJECT',
'WRITE_MIN_PAUSE_S', 'IDLE_CONN_MAX_S', 'NATS_QUEUE',
'GRPC_ENABLED',
'GRPC_PORT',
'CERT_BUCKET',
'CERT_CACHE_DIR',
'WRITE_TIMESTAMP',
'WRITE_QUALITY',
'WRITE_MIN_PAUSE_S',
'IDLE_CONN_MAX_S',
) )
@@ -45,13 +53,16 @@ def test_from_env_overrides(monkeypatch):
assert cfg.write_quality is False assert cfg.write_quality is False
@pytest.mark.parametrize('value,expected', [ @pytest.mark.parametrize(
('0', False), 'value,expected',
('no', False), [
('FALSE', False), ('0', False),
('1', True), ('no', False),
('YES', True), ('FALSE', False),
]) ('1', True),
('YES', True),
],
)
def test_bool_parsing_edge_cases(monkeypatch, value, expected): def test_bool_parsing_edge_cases(monkeypatch, value, expected):
monkeypatch.setenv('GRPC_ENABLED', value) monkeypatch.setenv('GRPC_ENABLED', value)

View File

@@ -28,8 +28,13 @@ def mocks(monkeypatch):
patched[name] = m patched[name] = m
patched['build_postgres_config'].return_value = { patched['build_postgres_config'].return_value = {
'host': 'localhost', 'port': 5432, 'user': 'u', 'password': 'p', 'host': 'localhost',
'dbname': 'd', 'min_connections': 5, 'max_connections': 20, 'port': 5432,
'user': 'u',
'password': 'p',
'dbname': 'd',
'min_connections': 5,
'max_connections': 20,
} }
patched['OpcConnectionPool'].return_value.close_all = AsyncMock() patched['OpcConnectionPool'].return_value.close_all = AsyncMock()
patched['OpcConnectionPool'].return_value.release_idle = AsyncMock() patched['OpcConnectionPool'].return_value.release_idle = AsyncMock()
@@ -52,8 +57,12 @@ def make_runtime(**config_overrides):
def test_builds_object_graph_with_config_flags(mocks): def test_builds_object_graph_with_config_flags(mocks):
runtime = make_runtime( runtime = make_runtime(
write_timestamp=False, write_quality=False, write_min_pause_s=0.25, write_timestamp=False,
cert_bucket='my-bucket', cert_cache_dir='certs-cache', grpc_enabled=False, write_quality=False,
write_min_pause_s=0.25,
cert_bucket='my-bucket',
cert_cache_dir='certs-cache',
grpc_enabled=False,
) )
mocks['OpcConnectionPool'].assert_called_once() mocks['OpcConnectionPool'].assert_called_once()