From c5325d95b8bc2c832724f3a5c6fbc634cc3ff444 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Wed, 11 Sep 2024 12:46:39 +0200 Subject: [PATCH] test_traverse_project: Add tests using the Conda sample project --- tests/test_traverse_project.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/test_traverse_project.py b/tests/test_traverse_project.py index b28f330a..cb2d8201 100644 --- a/tests/test_traverse_project.py +++ b/tests/test_traverse_project.py @@ -78,6 +78,12 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]: # dot-paths by default. # expect_pyenv_src={".pixi/envs/default/lib/python3.12/site-packages"}, # noqa: ERA001 ), + TraverseProjectVector( + "default_traversal_in_conda_example__yields_py_and_deps_file", + "conda_example", + expect_imports_src={"main.py"}, + expect_deps_src={"environment.yml"}, + ), # # Testing 'code' alone: # @@ -277,6 +283,14 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]: pyenvs=set(), expect_deps_src={"pixi.toml"}, ), + TraverseProjectVector( + "given_deps_as_environment_yml__yields_file", + "conda_example", + code=set(), + deps={"environment.yml"}, + pyenvs=set(), + expect_deps_src={"environment.yml"}, + ), # # Test interaction of 'deps_parser_choice' and 'deps' as file vs dir # @@ -588,6 +602,20 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]: }, skip_me=on_windows("POSIX-style Pixi environments skipped on Windows"), ), + TraverseProjectVector( + "given_dot_conda__finds_pyenv_inside_dot_conda", + "conda_example", + code=set(), + deps=set(), + pyenvs={".conda"}, + # .conda/ here really is a stand-in for ~/.conda, which is where Conda + # usually keeps its environments. + expect_pyenv_src={ + ".conda/envs/conda_example/lib/python3.1/site-packages", # symlink + ".conda/envs/conda_example/lib/python3.12/site-packages", + }, + skip_me=on_windows("POSIX-style Conda environments skipped on Windows"), + ), # # Test interaction of 'pyenvs' with 'code' and 'deps': # @@ -705,6 +733,18 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]: }, skip_me=on_windows("POSIX-style Pixi environments skipped on Windows"), ), + TraverseProjectVector( + "given_pyenv_dot_conda__finds_everything_inside_conda_project", + "conda_example", + pyenvs={".conda"}, + expect_imports_src={"main.py"}, + expect_deps_src={"environment.yml"}, + expect_pyenv_src={ + ".conda/envs/conda_example/lib/python3.1/site-packages", # symlink + ".conda/envs/conda_example/lib/python3.12/site-packages", + }, + skip_me=on_windows("POSIX-style Conda environments skipped on Windows"), + ), # # Test invalid 'exclude': #