test_: Code Migration from status-cli-tests logger removal

This commit is contained in:
shashankshampi 2024-11-02 20:30:18 +05:30 committed by Florin Barbu
parent 942a59e22d
commit 91e9a86a30
No known key found for this signature in database
GPG Key ID: 593D6DBC6D9E5095
2 changed files with 5 additions and 6 deletions

View File

@ -1,5 +1,4 @@
import json
import logging
import time
from src.libs.common import write_signal_to_file
@ -33,7 +32,7 @@ class SignalClient:
raise TimeoutError(
f"Signal {signal_type} is not received in {timeout} seconds")
time.sleep(0.2)
logging.debug(f"Signal {signal_type} is received in {round(time.time() - start_time)} seconds")
logger.debug(f"Signal {signal_type} is received in {round(time.time() - start_time)} seconds")
return self.received_signals[signal_type][0]
def wait_for_complete_signal(self, signal_type, timeout=5):
@ -47,7 +46,7 @@ class SignalClient:
time.sleep(0.2)
if events:
logging.debug(
logger.debug(
f"Collected {len(events)} events of type {signal_type} within {timeout} seconds")
return events
raise TimeoutError(f"No signals of type {signal_type} received in {timeout} seconds")

View File

@ -1,4 +1,3 @@
import logging
from uuid import uuid4
from constants import *
from src.libs.common import delay
@ -10,6 +9,7 @@ from validators.contact_request_validator import ContactRequestValidator
logger = get_custom_logger(__name__)
class TestContactRequest(StepsCommon):
def test_contact_request_baseline(self):
timeout_secs = 3
@ -112,7 +112,7 @@ class TestContactRequest(StepsCommon):
)
break
except AssertionError as validation_error:
logging.error(f"Validation failed for event: {messages_new_event}, Error: {validation_error}")
logger.error(f"Validation failed for event: {messages_new_event}, Error: {validation_error}")
continue
if messages_new_event is None:
@ -120,7 +120,7 @@ class TestContactRequest(StepsCommon):
first_node.wait_for_signal("history.request.completed", timeout)
except (TimeoutError, ValueError) as e:
logging.error(f"Signal validation failed: {str(e)}")
logger.error(f"Signal validation failed: {str(e)}")
return timestamp, message_id, contact_request_message, None
first_node.stop()