Skip to content

feat: basic tests for no-scan mode #5138

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

joydeep049
Copy link
Contributor

Related Discussion : #5136

cc @terriko @anthonyharrison @mastersans

assert result.returncode == 0


def test_no_scan_output():
Copy link
Member

Choose a reason for hiding this comment

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

seems like this particular test is failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Initially I tried cve-bin-tool <directory> --no-scan but that failed
Then I changed the entry point to cve_bin_tool/cli.py but that seems to fail too

Surprising how --no-scan shows up in python3 cve_bin_tool/cli.py --help but not in the above

@joydeep049
Copy link
Contributor Author

Re-running the tests with an empty commit because:
12 06 2025_22 35 43_REC

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.

FYI: still failing:

 =========================== short test summary info ===========================
FAILED test/test_no_scan.py::test_normal_scan - TypeError: argument of type 'NoneType' is not iterable
===== 1 failed, 2275 passed, 48 skipped, 8 warnings in 3420.69s (0:57:00) =====

There's also a pyupgrade linter fail so you should probably run that and see what got deprecated.

@stvml
Copy link
Contributor

stvml commented Jun 13, 2025

Looks like this might be the underlying issue that caused the failure:

test/test_no_scan.py::test_normal_scan
  C:\hostedtoolcache\windows\Python\3.12.10\x64\Lib\site-packages\_pytest\threadexception.py:58: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-5 (_readerthread)
  
  Traceback (most recent call last):
    File "C:\hostedtoolcache\windows\Python\3.12.10\x64\Lib\threading.py", line 1075, in _bootstrap_inner
      self.run()
    File "C:\hostedtoolcache\windows\Python\3.12.10\x64\Lib\threading.py", line 1012, in run
      self._target(*self._args, **self._kwargs)
    File "C:\hostedtoolcache\windows\Python\3.12.10\x64\Lib\subprocess.py", line 1599, in _readerthread
      buffer.append(fh.read())
                    ^^^^^^^^^
    File "C:\hostedtoolcache\windows\Python\3.12.10\x64\Lib\encodings\cp1252.py", line 23, in decode
      return codecs.charmap_decode(input,self.errors,decoding_table)[0]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 21620: character maps to <undefined>

Possibly a text encoding problem on Windows?

@terriko
Copy link
Contributor

terriko commented Jun 25, 2025

BTW, the linters should be back up if you need them, but the rest of the tests are still failing due to the cache.

@terriko
Copy link
Contributor

terriko commented Aug 20, 2025

I'm going to update hte branch to see where we're at now.

@joydeep049 joydeep049 changed the title feat: basic tests and doc changes for no-scan mode feat: basic tests for no-scan mode Aug 21, 2025
Signed-off-by: joydeep049 <[email protected]>
@joydeep049
Copy link
Contributor Author

=================================== FAILURES ===================================
________________ TestOutputHTML.test_modal_switching[chromium] _________________
[gw0] linux -- Python 3.13.7 /opt/hostedtoolcache/Python/3.13.7/x64/bin/python

self = <test.test_html.TestOutputHTML object at 0x7fe4dbc32710>

    def test_modal_switching(self) -> None:
        """Test modal to be visible when clicked on the product row or the vendor_product pill
        and to be hidden when clicked on the close button"""
    
        modal_content = self.html_report_page.modal_content.nth(0)
        product_row = self.html_report_page.product_rows.nth(0)
        modal_close_button = self.html_report_page.modal_close_button.nth(0)
        vendor_product_pill = self.html_report_page.vendor_product_pill.nth(0)
    
        expect(modal_content).to_be_hidden()
        product_row.click()
        expect(modal_content).to_be_visible()
        modal_close_button.click()
>       expect(modal_content).to_be_hidden(timeout=10000)
E       AssertionError: Locator expected to be hidden
E       Actual value: visible 
E       Call log:
E         - Expect "to_be_hidden" with timeout 10000ms
E         - waiting for locator(".modal-content").first
E           14 × locator resolved to <div class="modal-content"></div>
E              - unexpected value "visible"

test/test_html.py:206: AssertionError

I do not understand what's going on here. @terriko @anthonyharrison

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.

4 participants