66import os
77import time
88import uuid
9- import traceback as _traceback
9+ import sys
10+ import traceback
1011
1112from systemd import journal , id128
1213from systemd .journal import _make_line
@@ -30,7 +31,7 @@ def send(self, MESSAGE, MESSAGE_ID=None,
3031 args .append ('MESSAGE_ID=' + id )
3132
3233 if CODE_LINE is CODE_FILE is CODE_FUNC is None :
33- CODE_FILE , CODE_LINE , CODE_FUNC = _traceback .extract_stack (limit = 2 )[0 ][:3 ]
34+ CODE_FILE , CODE_LINE , CODE_FUNC = traceback .extract_stack (limit = 2 )[0 ][:3 ]
3435 if CODE_FILE is not None :
3536 args .append ('CODE_FILE=' + CODE_FILE )
3637 if CODE_LINE is not None :
@@ -294,13 +295,16 @@ def test_reader_convert_timestamps(tmpdir):
294295 j = journal .Reader (path = tmpdir .strpath )
295296
296297 val = j ._convert_field ('_SOURCE_REALTIME_TIMESTAMP' , 1641651559324187 )
297- assert val .tzinfo is not None
298+ if sys .version_info >= (3 ,):
299+ assert val .tzinfo is not None
298300
299301 val = j ._convert_field ('__REALTIME_TIMESTAMP' , 1641651559324187 )
300- assert val .tzinfo is not None
302+ if sys .version_info >= (3 ,):
303+ assert val .tzinfo is not None
301304
302305 val = j ._convert_field ('COREDUMP_TIMESTAMP' , 1641651559324187 )
303- assert val .tzinfo is not None
306+ if sys .version_info >= (3 ,):
307+ assert val .tzinfo is not None
304308
305309def test_seek_realtime (tmpdir ):
306310 j = journal .Reader (path = tmpdir .strpath )
0 commit comments