File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,9 @@ def main(argv=None):
298
298
if argv is None :
299
299
argv = sys .argv
300
300
301
+ # Reset logger level to info
302
+ LOGGER .setLevel (logging .INFO )
303
+
301
304
parser = argparse .ArgumentParser (
302
305
prog = "cve-bin-tool" ,
303
306
description = textwrap .dedent (
Original file line number Diff line number Diff line change 1
1
"""
2
2
CVE-bin-tool CLI tests
3
3
"""
4
- import os
5
- import unittest
6
4
import logging
5
+ import os
7
6
import subprocess
7
+ import unittest
8
+
8
9
from cve_bin_tool .cli import main
9
10
from cve_bin_tool .cvedb import DISK_LOCATION_DEFAULT
10
11
from cve_bin_tool .extractor import Extractor
11
-
12
12
from .utils import (
13
13
TempDirTest ,
14
14
download_file ,
@@ -219,3 +219,20 @@ def test_unknown_warning(self):
219
219
warnings = [i for i in cm .output if "WARNING" in i ]
220
220
self .assertTrue (len (warnings ) > 0 )
221
221
self .assertTrue ("was detected with version UNKNOWN" in "" .join (warnings ))
222
+
223
+ def test_quiet_mode (self ):
224
+ """ Test that an quite mode isn't generating any output """
225
+ logger = logging .getLogger ()
226
+
227
+ # build the test file in test/binaries
228
+ binaries_path = os .path .join (
229
+ os .path .abspath (os .path .dirname (__file__ )), "binaries"
230
+ )
231
+ filename = "test-python-3.7.1.out"
232
+ subprocess .call (["make" , filename ], cwd = binaries_path )
233
+
234
+ with self .assertLogs (logger , logging .INFO ) as cm :
235
+ main (["cve-bin-tool" , "-q" , os .path .join (binaries_path , filename )])
236
+ logger .info ("test" )
237
+
238
+ self .assertEqual (["INFO:root:test" ], cm .output )
You can’t perform that action at this time.
0 commit comments