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

Replace deprecated test functions #310

Merged
merged 4 commits into from
Mar 6, 2025

Conversation

marcoesters
Copy link
Contributor

Description

conda.testing.integration.run_command has been deprecated. Use conda.testing.fixtures.conda_cli instead.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@github-project-automation github-project-automation bot moved this to 🆕 New in 🔎 Review Mar 4, 2025
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Mar 4, 2025
Copy link
Contributor

@kenodegard kenodegard left a comment

Choose a reason for hiding this comment

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

Several observations:

  1. conda_cli is a pytest fixture and thus cannot be called directly
  2. While we can import it as you've done here to expose the fixture to all tests in this file it is preferred to use the pytest_plugins constant to keep linters happy https://docs.pytest.org/en/stable/how-to/writing_plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file
  3. I suggest replacing new_environment with the tmp_env fixture instead

@github-project-automation github-project-automation bot moved this from 🆕 New to 🏗️ In Progress in 🔎 Review Mar 5, 2025
@marcoesters
Copy link
Contributor Author

Several observations:

1. `conda_cli` is a pytest fixture and thus cannot be called directly

2. While we can import it as you've done here to expose the fixture to all tests in this file it is preferred to use the `pytest_plugins` constant to keep linters happy https://docs.pytest.org/en/stable/how-to/writing_plugins.html#requiring-loading-plugins-in-a-test-module-or-conftest-file

3. I suggest replacing `new_environment` with the `tmp_env` fixture instead

I realized that a little too late. Using the tmp_env fixture will take a little more rewriting, but it is necessary to not have the tests break.

@marcoesters
Copy link
Contributor Author

I ended up using the conda_cli fixture instead of tmp_env because the tests monitor the output stream. Menuinst exceptions do not result in a non-zero exit code, but should result in a test failure.

@marcoesters marcoesters requested a review from kenodegard March 5, 2025 22:30
@marcoesters marcoesters marked this pull request as ready for review March 5, 2025 22:30
@marcoesters marcoesters requested a review from a team as a code owner March 5, 2025 22:30
@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to ✅ Approved in 🔎 Review Mar 6, 2025
@marcoesters marcoesters merged commit df271d6 into conda:main Mar 6, 2025
16 checks passed
@github-project-automation github-project-automation bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Mar 6, 2025
@marcoesters marcoesters deleted the remove-deprecated-functions branch March 20, 2025 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed [bot] added once the contributor has signed the CLA
Projects
Status: 🏁 Done
Development

Successfully merging this pull request may close these issues.

3 participants