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

Unit test infrastructure fixes #2749

Merged
merged 8 commits into from
Jan 6, 2025

Conversation

jku
Copy link
Member

@jku jku commented Dec 10, 2024

Refactor unit test infra. The goal is to remove workarounds and enable testing outside the project:

  • Stop requiring the annoying cd test/ && python ./aggregate_tests.py hack: this is non-standard and leads to endless problems. Instead allow the test suite to run from source root
  • Fix the tests that break when we do this
  • aggregate_tests.py itself has no real functionality and can be removed (it used to handle test run order randomization but that has been removed already)
  • Remove various workarounds that were needed because of this hack
    • editable install of python-tuf should not be needed anymore
    • coverage now finds the config in pyproject.toml
    • dev-mode-dirs is not needed by hatchling anymore (I've tested package build manually: works identically)
    • tox no longer needs changedir tricks

Fixes #2745

We don't actually want to return anything here: just
make sure download_file() gets executed

Signed-off-by: Jussi Kukkonen <[email protected]>
@coveralls
Copy link

coveralls commented Dec 10, 2024

Pull Request Test Coverage Report for Build 12273900862

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.1%) to 97.105%

Totals Coverage Status
Change from base Build 12251104236: 1.1%
Covered Lines: 1586
Relevant Lines: 1605

💛 - Coveralls

@jku jku force-pushed the test-fixes branch 2 times, most recently from a03b59e to 276200f Compare December 11, 2024 08:09
jku added 6 commits December 11, 2024 10:11
This was essentially unused now (originally it was used to
randomize the test order).

Signed-off-by: Jussi Kukkonen <[email protected]>
"python -m unittest" now works in the root source dir too

Signed-off-by: Jussi Kukkonen <[email protected]>
This was only needed because tests needed changing to tests/ dir:
this is no longer the case.

Signed-off-by: Jussi Kukkonen <[email protected]>
Tests now run from root dir so various coverage complications
can be removed.

Also remove the duplicate .coveragerc and rely on pyproject.toml

Signed-off-by: Jussi Kukkonen <[email protected]>
We always want to either verify or generate new results:
don't have multiple arguments.

Also fix annotated types.

Signed-off-by: Jussi Kukkonen <[email protected]>
This was likely only necessary because the test suite required it:
Now tuf does not get installed at all by tox (or by dev install)

Signed-off-by: Jussi Kukkonen <[email protected]>
@jku jku marked this pull request as ready for review December 11, 2024 08:20
@jku jku requested a review from a team as a code owner December 11, 2024 08:20
@jku jku changed the title Test fixes Unit test infrastructure fixes Dec 11, 2024
tests/.coveragerc Show resolved Hide resolved
This was in use in tests/.coveragerc: previously. Enable in
pyproject config too.

Signed-off-by: Jussi Kukkonen <[email protected]>
@jku
Copy link
Member Author

jku commented Dec 11, 2024

Overall coverage increased (+1.1%) to 97.105%

This is because CI + coveralls was not using the pyproject config before this so some relevant excludes were not getting picked up previously when running coverage there

@kairoaraujo
Copy link
Collaborator

Adding to my TODO

@kairoaraujo kairoaraujo self-requested a review December 17, 2024 08:45
@kairoaraujo kairoaraujo merged commit 467e806 into theupdateframework:develop Jan 6, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running pytest fails due to path issues: No such file or directory: 'generated_data/ed25519_metadata'
3 participants