common.py
Go to the documentation of this file.
1 # License: Apache 2.0. See LICENSE file in root directory.
2 # Copyright(c) 2022 Intel Corporation. All Rights Reserved.
3 
4 from rspy import log, test
5 import pyrealsense2 as rs
6 import os
7 
8 
9 def log_all():
10  rs.log( rs.log_severity.debug, "debug message" )
11  rs.log( rs.log_severity.info, "info message" )
12  rs.log( rs.log_severity.warn, "warn message" )
13  rs.log( rs.log_severity.error, "error message" )
14  # NOTE: fatal messages will exit the process and so cannot be tested
15  #rs.log( rs.log_severity.fatal, "fatal message" )
16  rs.log( rs.log_severity.none, "no message" ) # ignored; no callback
17 
18 
19 n_messages = 0
20 def message_counter( severity, message ):
21  global n_messages
22  n_messages += 1
23  log.d( message.full() )
24  #
25  test.check_equal( str(message), message.raw() )
26  test.check_equal( repr(message), message.full() )
27 
28 
29 n_messages_2 = 0
30 def message_counter_2( severity, message ):
31  global n_messages_2
32  n_messages_2 += 1
33  log.d( message.full() )
34 
35 
36 def count_lines( filename ):
37  # -1 because the text always has an extra \n
38  return len( open( filename, 'rt' ).read().split( '\n' )) - 1
split
std::vector< uint32_t > split(const std::string &s, char delim)
Definition: unit-tests-live.cpp:2104
common.log_all
def log_all()
Definition: common.py:9
common.count_lines
def count_lines(filename)
Definition: common.py:36
read_bag_example.str
str
Definition: read_bag_example.py:21
repr
std::string repr(rs2::device const &self)
Definition: live-common.h:13
common.message_counter_2
def message_counter_2(severity, message)
Definition: common.py:30
common.message_counter
def message_counter(severity, message)
Definition: common.py:20


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01