Skip to content

Failing test for CycloneDX output plugin #2917

Description

@JonoYang

I am failing this CycloneDX output test

_________________________________________________________________ test_cyclonedx_plugin_xml_components_and_dependencies_are_serialized_correctly __________________________________________________________________
[gw1] linux -- Python 3.6.9 /home/jono/nexb/src/scancode-toolkit-2/venv/bin/python

    def test_cyclonedx_plugin_xml_components_and_dependencies_are_serialized_correctly():
        test_dir = test_env.get_test_loc('cyclonedx/simple')
        result_file = test_env.get_temp_file('cyclonedx.xml')
        run_scan_click(['-p', test_dir, '--cyclonedx-xml', result_file])
        expected_file = test_env.get_test_loc('cyclonedx/expected.xml')
>       check_cyclone_xml_output(expected_file, result_file, regen=REGEN_TEST_FIXTURES)

tests/formattedcode/test_output_cyclonedx.py:233: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/formattedcode/test_output_cyclonedx.py:73: in check_cyclone_xml_output
    expected = load_and_clean_xml(expected_file)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

location = '/home/jono/nexb/src/scancode-toolkit-2/tests/formattedcode/data/cyclonedx/expected.xml'

    def load_and_clean_xml(location):
        """
        Return plain Python nested data for the CycloneDX file at location
        suitable for comparison. The file content is cleaned from variable
        parts such as dates, generated UUIDs and versions
        """
        with open(location, 'rb') as co:
            xml_text = co.read()
        parser = etree.XMLParser(
            recover=True,
            remove_comments=True,
            remove_pis=True,
            remove_blank_text=True,
            resolve_entities=False
        )
        bom = etree.fromstring(xml_text, parser=parser)
        bom.set('serialNumber', '')
    
        metadata = bom.find('{http://cyclonedx.org/schema/bom/1.3}metadata')
>       bom.remove(metadata)
E       TypeError: Argument 'element' has incorrect type (expected lxml.etree._Element, got NoneType)

tests/formattedcode/test_output_cyclonedx.py:97: TypeError

I tried regenerating the test expectations, but it doesn't seem to change the existing test expectations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions