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

tests: meaningful names to validation tests #588

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

claui
Copy link
Contributor

@claui claui commented Apr 12, 2024

When packaging cyclonedx-python-lib for a Linux distribution, it’s pretty common that some JSON validation tests fail.

Due to the large number of combinations and the fact that these tests are consecutively numbered, it has been tedious to figure out which tests are exactly failing and why.
This in turn makes it difficult to decide which tests to disable or report upstream.

This PR appends meaningful names to validation tests so that instead of e.g.:

[…]::TestJsonValidator::test_validate_no_none_001
[…]::TestJsonValidator::test_validate_no_none_002
[…]::TestJsonValidator::test_validate_no_none_003
[…]::TestJsonValidator::test_validate_no_none_004
[…]::TestJsonValidator::test_validate_no_none_005
[…]::TestJsonValidator::test_validate_no_none_006
[…]::TestJsonValidator::test_validate_no_none_007
[…]::TestJsonValidator::test_validate_no_none_008

the tests are named:

[…]::TestJsonValidator::test_validate_no_none_001_valid_component_swid_1_6
[…]::TestJsonValidator::test_validate_no_none_002_valid_machine_learning_considerations_env_1_6
[…]::TestJsonValidator::test_validate_no_none_003_valid_metadata_tool_1_6
[…]::TestJsonValidator::test_validate_no_none_004_valid_patch_1_6
[…]::TestJsonValidator::test_validate_no_none_005_valid_empty_components_1_6
[…]::TestJsonValidator::test_validate_no_none_006_valid_properties_1_6
[…]::TestJsonValidator::test_validate_no_none_007_valid_service_1_6
[…]::TestJsonValidator::test_validate_no_none_008_valid_metadata_author_1_6

@claui claui requested a review from a team as a code owner April 12, 2024 20:31
@jkowalleck jkowalleck changed the title Add meaningful names to validation tests tests: meaningful names to validation tests Apr 12, 2024
@jkowalleck jkowalleck added the QA Quality Assurance label Apr 12, 2024
@jkowalleck
Copy link
Member

@claui thank you for the contribution. some CI/CT/QA tests are failing - could you check and fix?
see https://github.com/CycloneDX/cyclonedx-python-lib/pull/588/checks

@claui
Copy link
Contributor Author

claui commented Apr 12, 2024

@jkowalleck On it.

@claui
Copy link
Contributor Author

claui commented Apr 12, 2024

@jkowalleck Updated, should be good now.

@jkowalleck
Copy link
Member

jkowalleck commented Apr 12, 2024

i saw https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=python-cyclonedx-lib#n53

Consistently failing during check in a clean chroot, but passing
outside chroot. Also passing in upstream CI. Needs more analysis.

did not look into the details, but I'd suggest you try to set env var PYTHONHASHSEED=0
maybe this helps.

tests/__init__.py Outdated Show resolved Hide resolved
@claui
Copy link
Contributor Author

claui commented Apr 12, 2024

I'd suggest you try to set env var PYTHONHASHSEED=0
maybe this helps.

Thanks for the suggestion. However, that didn’t change anything.

When packaging cyclonedx-python-lib for a Linux distribution, it’s
pretty common that some JSON validation tests fail. [1]

Due to the large number of combinations and the fact that these tests
are consecutively numbered, it has been tedious to figure out which
tests are exactly failing and why. This in turn makes it difficult to
decide which tests to disable or report upstream.

Append meaningful names to validation tests so that instead of e.g.:

    […]::TestJsonValidator::test_validate_no_none_001
    […]::TestJsonValidator::test_validate_no_none_002
    […]::TestJsonValidator::test_validate_no_none_003
    […]::TestJsonValidator::test_validate_no_none_004
    […]::TestJsonValidator::test_validate_no_none_005
    […]::TestJsonValidator::test_validate_no_none_006
    […]::TestJsonValidator::test_validate_no_none_007
    […]::TestJsonValidator::test_validate_no_none_008

the tests are named:

    […]::TestJsonValidator::test_validate_no_none_001_valid_component_swid_1_6
    […]::TestJsonValidator::test_validate_no_none_002_valid_machine_learning_considerations_env_1_6
    […]::TestJsonValidator::test_validate_no_none_003_valid_metadata_tool_1_6
    […]::TestJsonValidator::test_validate_no_none_004_valid_patch_1_6
    […]::TestJsonValidator::test_validate_no_none_005_valid_empty_components_1_6
    […]::TestJsonValidator::test_validate_no_none_006_valid_properties_1_6
    […]::TestJsonValidator::test_validate_no_none_007_valid_service_1_6
    […]::TestJsonValidator::test_validate_no_none_008_valid_metadata_author_1_6

[1]: https://aur.archlinux.org/cgit/aur.git/diff/PKGBUILD?h=python-cyclonedx-lib&id=9c6ae556874a633a521407a77a9a85bb31da2047

Signed-off-by: Claudia <claui@users.noreply.github.com>
@jkowalleck jkowalleck merged commit ae3f79c into CycloneDX:main Apr 12, 2024
41 checks passed
@claui claui deleted the test-names branch April 12, 2024 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA Quality Assurance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants