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

chore: speed up functional tests #598

Merged

Conversation

mkniewallner
Copy link
Collaborator

@mkniewallner mkniewallner commented Mar 15, 2024

Resolves #597.

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

Description of changes

This speeds up functional tests by implementing the 2 solutions mentioned in: #597:

  • a deptry wheel is now built at the beginning of functional tests, then used whenever a functional test needs to bootstrap a new environment
  • tests are now run in parallel using loadgroup, to ensure that tests that use the same test project end up on the same process, since if we have multiple tests that bootstrap the same project, we only bootstrap the project once

The speedup is definitetely noticeable by comparing a recent build with a build in this PR. If we take linux (3.12, x86_64) as an example, we go from ~167s to ~66s.

@mkniewallner mkniewallner force-pushed the chore/speed-up-functional-tests branch 5 times, most recently from 008a775 to d8d3c82 Compare March 16, 2024 00:06
Copy link

codecov bot commented Mar 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.7%. Comparing base (7cf0aab) to head (d29da65).

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #598     +/-   ##
=======================================
- Coverage   91.1%   90.7%   -0.4%     
=======================================
  Files         38      38             
  Lines       1086    1086             
  Branches     224     224             
=======================================
- Hits         990     986      -4     
- Misses        81      85      +4     
  Partials      15      15             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mkniewallner mkniewallner force-pushed the chore/speed-up-functional-tests branch 2 times, most recently from 143fe02 to b46d7cb Compare March 16, 2024 00:27
@mkniewallner mkniewallner changed the title chore: speed up functional tests by installing deptry from wheel chore: speed up functional tests Mar 16, 2024
@mkniewallner mkniewallner force-pushed the chore/speed-up-functional-tests branch 2 times, most recently from e1a5c76 to 7a94e55 Compare March 16, 2024 00:41
@mkniewallner mkniewallner marked this pull request as ready for review March 16, 2024 01:08
@mkniewallner mkniewallner requested a review from fpgmaas March 16, 2024 01:08
@@ -14,13 +14,18 @@ check: ## Run code quality tools.
@echo "🚀 Checking for dependency issues: Running deptry"
@pdm run deptry python

.PHONY: test
Copy link
Owner

@fpgmaas fpgmaas Mar 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an idea to keep this command to make it easier to run all unit tests locally?

Suggested change
.PHONY: test
.PHONY test:
test: test-unit test-functional

```bash
make test
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add the make test command back like suggested above, we can revert this change.

Makefile Outdated
.PHONY: test-functional
test-functional: ## Run functional tests.
@echo "🚀 Running functional tests"
@pdm run pytest tests/functional -n auto
Copy link
Owner

@fpgmaas fpgmaas Mar 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add --dist loadgroup here?

Suggested change
@pdm run pytest tests/functional -n auto
@pdm run pytest tests/functional -n auto --dist loadgroup

@mkniewallner mkniewallner force-pushed the chore/speed-up-functional-tests branch from 716000b to d29da65 Compare March 16, 2024 08:32
@mkniewallner mkniewallner merged commit 95477b9 into fpgmaas:main Mar 16, 2024
29 checks passed
@mkniewallner mkniewallner deleted the chore/speed-up-functional-tests branch March 16, 2024 08:52
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.

Speed up functional tests
2 participants