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

Hard-coded versions in fixtures #334

Closed
bollwyvl opened this issue Jan 8, 2023 · 3 comments · Fixed by #335
Closed

Hard-coded versions in fixtures #334

bollwyvl opened this issue Jan 8, 2023 · 3 comments · Fixed by #335
Assignees
Labels
bug Something isn't working CT Continuous Testing

Comments

@bollwyvl
Copy link

bollwyvl commented Jan 8, 2023

It appears 3.1.3 replaces the VERSION string with 3.1.2, such that when the package is tested as-installed, as we do downstream on conda-forge, some very small differences appear:


self = <tests.test_output_xml.TestOutputXml testMethod=test_bom_external_references_v1_2>

    def test_bom_external_references_v1_2(self) -> None:
>       self._validate_xml_bom(
            bom=get_bom_with_external_references(), schema_version=SchemaVersion.V1_2,
            fixture='bom_external_references.xml'
        )

src/tests/test_output_xml.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/tests/test_output_xml.py:568: in _validate_xml_bom
    self.assertEqualXmlBom(expected_xml.read(), output, namespace=outputter.get_target_namespace())
src/tests/base.py:172: in assertEqualXmlBom
    self.assertEqualXml(
src/tests/base.py:141: in assertEqualXml
    self.assertEqual(len(diff_results), 0, f'There are XML differences: {diff_results}\n- {a}\n+ {b}')
E   AssertionError: 1 != 0 : There are XML differences: [UpdateTextIn(node='/ns0:bom/ns0:metadata/ns0:tools/ns0:tool/ns0:version[1]', text='3.1.3')]
E   - <ns0:bom xmlns:ns0="[http://cyclonedx.org/schema/bom/1.2"](http://cyclonedx.org/schema/bom/1.2%22) version="1" serialNumber="urn:uuid:45841f2e-a458-42ef-9b7b-bbfcc39e832f"><ns0:metadata><ns0:timestamp>2023-01-07T18:38:54.962510+00:00</ns0:timestamp><ns0:tools><ns0:tool><ns0:vendor>CycloneDX</ns0:vendor><ns0:name>cyclonedx-python-lib</ns0:name><ns0:version>3.1.2</ns0:version></ns0:tool></ns0:tools></ns0:metadata><ns0:components /><ns0:externalReferences><ns0:reference type="distribution"><ns0:url>https://cyclonedx.org</ns0:url><ns0:comment>No comment</ns0:comment></ns0:reference><ns0:reference type="website"><ns0:url>https://cyclonedx.org</ns0:url></ns0:reference></ns0:externalReferences></ns0:bom>
E   + <ns0:bom xmlns:ns0="[http://cyclonedx.org/schema/bom/1.2"](http://cyclonedx.org/schema/bom/1.2%22) version="1" serialNumber="urn:uuid:45841f2e-a458-42ef-9b7b-bbfcc39e832f"><ns0:metadata><ns0:timestamp>2023-01-07T18:38:54.962510+00:00</ns0:timestamp><ns0:tools><ns0:tool><ns0:vendor>CycloneDX</ns0:vendor><ns0:name>cyclonedx-python-lib</ns0:name><ns0:version>3.1.3</ns0:version></ns0:tool></ns0:tools></ns0:metadata><ns0:components /><ns0:externalReferences><ns0:reference type="distribution"><ns0:url>https://cyclonedx.org</ns0:url><ns0:comment>No comment</ns0:comment></ns0:reference><ns0:reference type="website"><ns0:url>https://cyclonedx.org</ns0:url></ns0:reference></ns0:externalReferences></ns0:bom>

(the only difference is <ns0:version>3.1.2</ns0:version> vs <ns0:version>3.1.3</ns0:version>)

We can patch around it, but this seems like it will eventually become a problem, depending on how many places need patching...

@jkowalleck jkowalleck self-assigned this Jan 8, 2023
@jkowalleck jkowalleck added bug Something isn't working CT Continuous Testing labels Jan 8, 2023
@jkowalleck
Copy link
Member

jkowalleck commented Jan 8, 2023

Thanks for the hint.

In the past, there were some attempts to use "VERSION" instead of the actual value, but they were inconsistent and caused this error you reported.

After the latest fix #335 the tests will no longer use the actual version of the library, but the constant string "TESTING".
This makes it future-prove.

Unfortunately, I cannot change the tests in the already existing version 3.1.3.
I don't think the version should be yanked, as its implementation is working as expected. Though, the tests fail.

Is there anything I can help with conda-forge?

@bollwyvl
Copy link
Author

Thanks for the speedy reply!

I don't think the version should be yanked

Agreed! I patched the tests and (tried to) ship 3.1.3, and will just remove the patches for >=3.1.3. But: 3.1.3 is not generally available yet due to some conda-forge automation issues stemming from some large-scale token cycling required, but should be up soon, but might take a few more plumbing PRs on my part.

Is there anything I can help with conda-forge?

Thanks for the offer! Everything has been pretty smooth, thus far, aside from the occasional transient dependency issue, about which a single library can't do much about.

The one thing that would be useful for downstreams is including the test files in the sdist uploaded to pypy: at present, these are downloaded separately, but sometimes git tags move, github-generated source tarballs change their SHA, etc. Having a single distribution, with a published SHA256, would simplify things a bit, but it's not a huge lift, and worth it to have tests.

If feeling very ambitious, we're always looking for more maintainers which usually just means "update a version pin or two and click merge." But on the main, just keep doing what you're doing!

@bollwyvl
Copy link
Author

Just to close the loop: https://anaconda.org/conda-forge/cyclonedx-python-lib/files?version=3.1.3

This was referenced Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CT Continuous Testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants