Skip to content
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

test: change way pytest is run in CI #1251

Merged
merged 7 commits into from
Jul 19, 2021
Merged

test: change way pytest is run in CI #1251

merged 7 commits into from
Jul 19, 2021

Conversation

terriko
Copy link
Contributor

@terriko terriko commented Jul 15, 2021

fixes: #1159

This switches the way we're running tests so that it does a full pytest gather for the async tests (minus a few files known to cause rate limiting issues). This will run a few tests that were not previously being run, and will help us so that new test files no longer need to be added manually to CI before they will run.

@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2021

Codecov Report

Merging #1251 (f71fc33) into main (792280b) will increase coverage by 2.19%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1251      +/-   ##
==========================================
+ Coverage   76.60%   78.80%   +2.19%     
==========================================
  Files         240      240              
  Lines        4501     4501              
  Branches      559      559              
==========================================
+ Hits         3448     3547      +99     
+ Misses        906      804     -102     
- Partials      147      150       +3     
Flag Coverage Δ
longtests 78.80% <ø> (+2.19%) ⬆️

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

Impacted Files Coverage Δ
cve_bin_tool/async_utils.py 91.66% <0.00%> (+1.38%) ⬆️
cve_bin_tool/helper_script.py 41.83% <0.00%> (+41.83%) ⬆️
test/test_async_utils.py 100.00% <0.00%> (+100.00%) ⬆️
test/test_helper_script.py 100.00% <0.00%> (+100.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 792280b...f71fc33. Read the comment docs.

Signed-off-by: Terri Oda <terri@toybox.ca>
Signed-off-by: Terri Oda <terri.oda@intel.com>
Signed-off-by: Terri Oda <terri.oda@intel.com>
@terriko
Copy link
Contributor Author

terriko commented Jul 19, 2021

Failing in test_helper_script on windows:

    def test_parse_filename(self, filename, product_name, version_name):
        hs = HelperScript(filename)
>       assert (product_name, version_name) == hs.parse_filename(filename)
E       AssertionError: assert ('bash', '4.2.46') == ('./Packages/bash', '4.2.46')
E         At index 0 diff: 'bash' != './Packages/bash'
E         Full diff:
E         - ('./Packages/bash', '4.2.46')
E         ?   -----------
E         + ('bash', '4.2.46')

test\test_helper_script.py:53: AssertionError
------------------------------ Captured log call ------------------------------
WARNING  cve_bin_tool.HelperScript:helper_script.py:247 
=================================================================
No match was found for "./Packages/bash" in database. 
Please check your file or try specifying the "product_name" also.
=================================================================
=========================== short test summary info ===========================
FAILED test/test_helper_script.py::TestHelperScript::test_parse_filename[./Packages/bash-4.2.46-34.el7.x86_64.rpm-bash-4.2.46]
================= 1 failed, 234 passed, 223 skipped in 26.68s =================

One test for bash is currently failing.  Since disabling a specific
parametrized test is a pain, I'm disabling the whole file on windows
only until it can be addressed. The tests still run on Linux.

Signed-off-by: Terri Oda <terri.oda@intel.com>
@terriko
Copy link
Contributor Author

terriko commented Jul 19, 2021

I've disabled test_helper_script.py in windows for now; I'll open up an issue to track it if I merge this before we have a fix there.

@terriko
Copy link
Contributor Author

terriko commented Jul 19, 2021

Saving a potential commit message:

Switch to using a full pytest gather for the async tests. Several test files are singled out to be run synchronously because they touch NVD and can cause us to get rate limited if they run in parallel.

This will ensure that no one needs to add new test files explicitly to CI unless they need to be run synchronously.

Several tests are (temporarily) disabled because they are not passing; we'll enable those as they are fixed.

@terriko terriko merged commit e089976 into intel:main Jul 19, 2021
peb-peb pushed a commit to peb-peb/cve-bin-tool that referenced this pull request Aug 2, 2021
* fixes: intel#1159
* test: change way pytest is run in CI

Switch to using a full pytest gather for the async tests. Several test files are singled out to be run synchronously because they touch NVD and can cause us to get rate limited if they run in parallel.

This will ensure that no one needs to add new test files explicitly to CI unless they need to be run synchronously.

Several test files are (temporarily) disabled because they are not passing; we'll enable those as they are fixed.

Signed-off-by: Terri Oda <terri.oda@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing tests in CI
2 participants