Skip to content

fix: xmlschema log msg #2546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 26, 2023
Merged

fix: xmlschema log msg #2546

merged 4 commits into from
Jan 26, 2023

Conversation

ayushthe1
Copy link
Contributor

Signed-off-by: ayush_gitk [email protected]

fixes #2530

The logger level is being set to logging.WARNING for 'xmlschema' so to suppress any INFO or DEBUG message that comes during using the cve-bin-tool.

Signed-off-by: ayush_gitk <[email protected]>
Signed-off-by: ayush_gitk <[email protected]>
@ayushthe1
Copy link
Contributor Author

I don't know why long tests are failing but flake tests are failing because the line import xmlschema (import level module) is not at the top. The problem is that this line has to be below the line logging.getLogger("xmlschema").setLevel(logging.WARNING) for the changes to work ,so i can't move it to top.
Could you suggest what i should do .

@terriko
Copy link
Contributor

terriko commented Jan 18, 2023

For flake8, there's a few possible fixes, but I think we'll want to use one of these two:

We can explicitly ignore the warning with some explanation as to why we're doing so:

#  This downgrades a message during module loading.
logging.getLogger("xmlschema").setLevel(logging.WARNING)
import xmlschema # noqa: E402

or we can do some if construction to fake out flake8:

# This downgrades a message during module loading.
if True:  # Strange construction for pep8 compliance.
    logging.getLogger("xmlschema").setLevel(logging.WARNING)
    import xmlschema

I don't particularly think one is a better solution than the other, but aesthetically I guess I like having the two lines together in a code block, so I'll put the second one in as a fix you can just accept if you want.

@terriko
Copy link
Contributor

terriko commented Jan 18, 2023

The linux tests should be fixable by updating the branch to main, the windows tests I'm still working on getting a working fix merged.

@terriko
Copy link
Contributor

terriko commented Jan 25, 2023

This hasn't been changed in a week, so I'm going to go ahead and accept my edit, update the branch to address the CI failures, and re-run the tests. It should fully pass this time.

@codecov-commenter
Copy link

codecov-commenter commented Jan 25, 2023

Codecov Report

Merging #2546 (3fd87d3) into main (e2305b2) will decrease coverage by 4.34%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2546      +/-   ##
==========================================
- Coverage   81.89%   77.55%   -4.34%     
==========================================
  Files         598      598              
  Lines        9874     9877       +3     
  Branches     1354     1355       +1     
==========================================
- Hits         8086     7660     -426     
- Misses       1433     1907     +474     
+ Partials      355      310      -45     
Flag Coverage Δ
longtests 76.63% <100.00%> (-4.80%) ⬇️
win-longtests 75.07% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cve_bin_tool/validator.py 100.00% <100.00%> (ø)
cve_bin_tool/data_sources/curl_source.py 36.45% <0.00%> (-58.34%) ⬇️
cve_bin_tool/data_sources/nvd_source.py 22.17% <0.00%> (-34.68%) ⬇️
cve_bin_tool/cvedb.py 41.64% <0.00%> (-30.70%) ⬇️
cve_bin_tool/data_sources/osv_source.py 34.11% <0.00%> (-28.51%) ⬇️
cve_bin_tool/data_sources/gad_source.py 48.75% <0.00%> (-21.25%) ⬇️
cve_bin_tool/data_sources/redhat_source.py 49.66% <0.00%> (-13.25%) ⬇️
cve_bin_tool/async_utils.py 83.44% <0.00%> (-11.04%) ⬇️
test/test_cli.py 77.30% <0.00%> (-10.64%) ⬇️
cve_bin_tool/output_engine/pdfbuilder.py 83.83% <0.00%> (-7.19%) ⬇️
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ayushthe1
Copy link
Contributor Author

Sorry @terriko ,was caught up in my exams so forgot about it. Thanks for making the changes and I'll be more regular from now.

Copy link
Contributor

@terriko terriko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is ready to merge -- there were some test fails, but they were unrelated to this PR (looks like there was a network issue on 3.9 short test, but the long tests passed on linux and all passed on windows)

@terriko terriko merged commit 58f6518 into intel:main Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: Change xmlschema message from info to debug
3 participants