38
38
39
39
from __future__ import annotations
40
40
import unittest
41
+ import platform
41
42
from logging import getLogger , Formatter , lastResort , LogRecord
42
43
from firebird .base .types import *
43
44
from firebird .base .logging import logging_manager , get_logger , bind_logger , \
@@ -78,6 +79,10 @@ def test_module(self):
78
79
self .assertIsNotNone (lastResort )
79
80
self .assertIsNotNone (lastResort .formatter )
80
81
def test_aaa (self ):
82
+ if int (platform .python_version_tuple ()[1 ]) < 11 :
83
+ AGENT = 'test_aaa (test_logging.TestLogging)'
84
+ else :
85
+ AGENT = 'test_aaa (test_logging.TestLogging.test_aaa)'
81
86
# root
82
87
with self .assertLogs () as log :
83
88
get_logger (self ).info ('Message' )
@@ -89,7 +94,7 @@ def test_aaa(self):
89
94
self .assertEqual (rec .filename , 'test_logging.py' )
90
95
self .assertEqual (rec .funcName , 'test_aaa' )
91
96
self .assertEqual (rec .topic , '' )
92
- self .assertEqual (rec .agent , 'test_aaa (test_logging.TestLogging)' )
97
+ self .assertEqual (rec .agent , AGENT )
93
98
self .assertEqual (rec .context , UNDEFINED )
94
99
self .assertEqual (rec .message , 'Message' )
95
100
# trace
@@ -103,7 +108,7 @@ def test_aaa(self):
103
108
self .assertEqual (rec .filename , 'test_logging.py' )
104
109
self .assertEqual (rec .funcName , 'test_aaa' )
105
110
self .assertEqual (rec .topic , 'trace' )
106
- self .assertEqual (rec .agent , 'test_aaa (test_logging.TestLogging)' )
111
+ self .assertEqual (rec .agent , AGENT )
107
112
self .assertEqual (rec .context , UNDEFINED )
108
113
self .assertEqual (rec .message , 'Message' )
109
114
def test_interpolation (self ):
0 commit comments