mirror of
https://github.com/status-im/status-go.git
synced 2025-01-23 05:00:35 +00:00
test_: Code Migration from status-cli-tests logger removal
This commit is contained in:
parent
670f17a25f
commit
26adbea3df
@ -1,5 +1,4 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
|
||||||
import time
|
import time
|
||||||
from src.libs.common import write_signal_to_file
|
from src.libs.common import write_signal_to_file
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ class SignalClient:
|
|||||||
raise TimeoutError(
|
raise TimeoutError(
|
||||||
f"Signal {signal_type} is not received in {timeout} seconds")
|
f"Signal {signal_type} is not received in {timeout} seconds")
|
||||||
time.sleep(0.2)
|
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]
|
return self.received_signals[signal_type][0]
|
||||||
|
|
||||||
def wait_for_complete_signal(self, signal_type, timeout=5):
|
def wait_for_complete_signal(self, signal_type, timeout=5):
|
||||||
@ -47,7 +46,7 @@ class SignalClient:
|
|||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
if events:
|
if events:
|
||||||
logging.debug(
|
logger.debug(
|
||||||
f"Collected {len(events)} events of type {signal_type} within {timeout} seconds")
|
f"Collected {len(events)} events of type {signal_type} within {timeout} seconds")
|
||||||
return events
|
return events
|
||||||
raise TimeoutError(f"No signals of type {signal_type} received in {timeout} seconds")
|
raise TimeoutError(f"No signals of type {signal_type} received in {timeout} seconds")
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import logging
|
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from constants import *
|
from constants import *
|
||||||
from src.libs.common import delay
|
from src.libs.common import delay
|
||||||
@ -10,6 +9,7 @@ from validators.contact_request_validator import ContactRequestValidator
|
|||||||
|
|
||||||
logger = get_custom_logger(__name__)
|
logger = get_custom_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TestContactRequest(StepsCommon):
|
class TestContactRequest(StepsCommon):
|
||||||
def test_contact_request_baseline(self):
|
def test_contact_request_baseline(self):
|
||||||
timeout_secs = 3
|
timeout_secs = 3
|
||||||
@ -112,7 +112,7 @@ class TestContactRequest(StepsCommon):
|
|||||||
)
|
)
|
||||||
break
|
break
|
||||||
except AssertionError as validation_error:
|
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
|
continue
|
||||||
|
|
||||||
if messages_new_event is None:
|
if messages_new_event is None:
|
||||||
@ -120,7 +120,7 @@ class TestContactRequest(StepsCommon):
|
|||||||
first_node.wait_for_signal("history.request.completed", timeout)
|
first_node.wait_for_signal("history.request.completed", timeout)
|
||||||
|
|
||||||
except (TimeoutError, ValueError) as e:
|
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
|
return timestamp, message_id, contact_request_message, None
|
||||||
|
|
||||||
first_node.stop()
|
first_node.stop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user