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

MAINT - Mock out calls to conda-lock for test_solve_lockfile #834

Merged

Conversation

peytondmurray
Copy link
Contributor

@peytondmurray peytondmurray commented Jun 12, 2024

Partially addresses #830.

Description

Currently test_solve_lockfile calls out to conda-lock and also invokes conda info, both of which are quite slow. This PR mocks out calls to conda-lock and conda in conda_store_server/tests/test_actions.py::test_solve_lockfile, and only checks that the invocations are correctly formed, not that conda-lock successfully executes. This reduces the runtime of the test to near zero.

Pull request checklist

  • Did you test this change locally?
  • Did you update the documentation (if required)?
  • Did you add/update relevant tests for this change (if required)?

Copy link

netlify bot commented Jun 12, 2024

Deploy Preview for conda-store canceled.

Name Link
🔨 Latest commit a90c80a
🔍 Latest deploy log https://app.netlify.com/sites/conda-store/deploys/666a16fc715316000867c71c

@peytondmurray peytondmurray force-pushed the 830-optimize-test-solve-lockfile branch from c689447 to a90c80a Compare June 12, 2024 21:45
Copy link
Collaborator

@trallard trallard left a comment

Choose a reason for hiding this comment

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

Thank you!!!! This looks pretty good and it makes sense to remove any third-party verification and focus only on what matters to conda-store. At least on unit tests.

Merging now!

Comment on lines +120 to +124
assert str(call_args["environment_files"][0]).endswith("environment.yaml")
assert call_args["platforms"] == platforms
assert str(call_args["lockfile_path"]).endswith("conda-lock.yaml")
assert call_args["conda_exe"] == conda_store.conda_command
assert call_args["with_cuda"] == cuda_version
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! I like that not only this focuses on what we own, and, therefore should be testing, but these asserts seem a lot more robust 🚀

@trallard trallard merged commit a98d96f into conda-incubator:main Jun 13, 2024
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done 💪🏾
Development

Successfully merging this pull request may close these issues.

2 participants