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

SPDX rdf tests pass automatically #3448

Closed
armintaenzertng opened this issue Jul 6, 2023 · 5 comments · Fixed by #3451
Closed

SPDX rdf tests pass automatically #3448

armintaenzertng opened this issue Jul 6, 2023 · 5 comments · Fixed by #3451
Labels

Comments

@armintaenzertng
Copy link
Contributor

Description

The SPDX rdf tests currently pass automatically. This is due to this line in the code, which basically sets expected == result per default.
The bug can be fixed by removing the linked line.

As almost all spdx tests are skipped via the @pytest.mark.scanslow annotation, this does not affect most of the tests.
However, if you remove these annotations they will fail with the above fix.

When upgrading the spdx-tools to the new 0.8 version, these test have to be slightly adapted, anyway. I can offer to do this while working on the library upgrade.

How To Reproduce

Remove this line in the code and execute for example this test (you have to remove the annotation first).

System configuration

Ubuntu 22.04.2 LTS, Scancode 32.0.5rc3

@armintaenzertng
Copy link
Contributor Author

I'm not sure about the other part of the if clause, which will also pass automatically due to this line. But maybe that is the intended behavior in that case?

@pombredanne
Copy link
Member

Great catch!
So the behaviour should be:

  1. if the test fixture regeneration environment variable REGEN_TEST_FIXTURES is set then the expected results file should be update with the latest results content.
  2. otherwise, the test should run and the results checked against pre-computed expected results

Therefore the whole block at

with io.open(expected_file, encoding='utf-8') as i:
expected = json.load(i)
expected = load_and_clean_rdf(result_file)
should be replaced by this:

expected = load_and_clean_rdf(expected_file)

@pombredanne
Copy link
Member

Can I interest you in a patch? 👼

@armintaenzertng
Copy link
Contributor Author

Can I interest you in a patch?

Yes, most certainly! :)
Can I interest you in our new spdx-tools version 0.8? :D

@armintaenzertng
Copy link
Contributor Author

@pombredanne, just in case you missed it, I opened a PR to fix this in #3451.

AyanSinhaMahapatra added a commit that referenced this issue Jul 17, 2023
Edit `check_rdf_scan` so that SPDX rdf tests don't automatically pass #3448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants