File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 2
2
# SPDX-License-Identifier: GPL-3.0-or-later
3
3
4
4
import logging
5
+ import re
5
6
import textwrap
6
7
7
8
import pytest
@@ -47,24 +48,28 @@ async def test_different_version(
47
48
) in caplog .record_tuples
48
49
49
50
@pytest .mark .asyncio
50
- async def test_exception (self , caplog , mocker : MockerFixture ):
51
+ async def test_exception (
52
+ self , caplog : pytest .LogCaptureFixture , mocker : MockerFixture
53
+ ) -> None :
51
54
52
55
mocker .patch ("requests.get" , sideEffect = Exception ())
53
56
54
57
check_latest_version ()
55
58
56
- assert (
57
- (
58
- "cve_bin_tool" ,
59
- logging .WARNING ,
59
+ assert any (
60
+ True
61
+ for logger_name , logger_level , message in caplog .record_tuples
62
+ if logger_name == "cve_bin_tool"
63
+ and logger_level == logging .WARNING
64
+ and re .match (
60
65
textwrap .dedent (
61
66
"""
62
67
-------------------------- Can't check for the latest version ---------------------------
63
68
warning: unable to access 'https://pypi.org/pypi/cve-bin-tool'
64
- Exception details: expected string or bytes-like object
69
+ Exception details: expected string or bytes-like object(?:.*)
65
70
Please make sure you have a working internet connection or try again later.
66
71
"""
67
72
),
73
+ message ,
68
74
)
69
- in caplog .record_tuples
70
75
)
You can’t perform that action at this time.
0 commit comments