Skip to content

Commit

Permalink
test_traverse_project: Add tests using the Pixi sample projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jherland committed Sep 11, 2024
1 parent 7521268 commit c32a645
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion tests/test_traverse_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]:

find_sources_vectors = [
TraverseProjectVector(
"default_traversal_in_empty_project_yields__nothing", "empty"
"default_traversal_in_empty_project__yields_nothing", "empty"
),
TraverseProjectVector(
"traverse_nothing_in_non_empty_project__yields_nothing",
Expand All @@ -67,6 +67,17 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]:
deps=set(),
pyenvs=set(),
),
TraverseProjectVector(
"default_traversal_in_pixi_default_example__yields_nothing",
"pixi_default_example",
expect_imports_src={"main.py"},
expect_deps_src={"pixi.toml"},
# TODO? Cannot auto-detect Pixi/Python environment inside
# .pixi/envs/default/, as .pixi/ itself is not the root of the
# environment (like .venv/ typically is), and we do not descend into
# dot-paths by default.
# expect_pyenv_src={".pixi/envs/default/lib/python3.12/site-packages"}, # noqa: ERA001
),
#
# Testing 'code' alone:
#
Expand Down Expand Up @@ -258,6 +269,14 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]:
pyenvs=set(),
expect_deps_src={"subdir1/setup.cfg", "subdir2/setup.py"},
),
TraverseProjectVector(
"given_deps_as_pixi_toml__yields_file",
"pixi_default_example",
code=set(),
deps={"pixi.toml"},
pyenvs=set(),
expect_deps_src={"pixi.toml"},
),
#
# Test interaction of 'deps_parser_choice' and 'deps' as file vs dir
#
Expand Down Expand Up @@ -557,6 +576,17 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]:
},
skip_me=not_on_windows("Windows-style venvs skipped on POSIX"),
),
TraverseProjectVector(
"given_dot_pixi__finds_pyenv_inside_dot_pixi",
"pixi_pyproject_example",
code=set(),
deps=set(),
pyenvs={".pixi"},
expect_pyenv_src={
".pixi/envs/default/lib/python3.1/site-packages",
".pixi/envs/default/lib/python3.12/site-packages",
},
),
#
# Test interaction of 'pyenvs' with 'code' and 'deps':
#
Expand Down Expand Up @@ -662,6 +692,17 @@ def not_on_windows(msg: str) -> Callable[[], Optional[str]]:
},
skip_me=not_on_windows("Windows-style venvs skipped on POSIX"),
),
TraverseProjectVector(
"given_pyenv_dot_pixi__finds_everything_inside_pixi_project",
"pixi_default_example",
pyenvs={".pixi"},
expect_imports_src={"main.py"},
expect_deps_src={"pixi.toml"},
expect_pyenv_src={
".pixi/envs/default/lib/python3.1/site-packages",
".pixi/envs/default/lib/python3.12/site-packages",
},
),
#
# Test invalid 'exclude':
#
Expand Down

0 comments on commit c32a645

Please sign in to comment.