-
Notifications
You must be signed in to change notification settings - Fork 3
fix: move clang tools dependencies to optional #92
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
Changes from 2 commits
47140e7
789b90b
7e6bf7a
fb84f57
3bbd310
7d82a56
e748d10
b8eb49e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,11 +102,13 @@ def test_get_version_from_dependency_success(): | |
| """Test get_version_from_dependency with valid pyproject.toml.""" | ||
| mock_toml_content = { | ||
| "project": { | ||
| "dependencies": [ | ||
| "clang-format==20.1.7", | ||
| "clang-tidy==20.1.0", | ||
| "other-package==1.0.0", | ||
| ] | ||
| "optional-dependencies": { | ||
| "tools": [ | ||
| "clang-format==20.1.7", | ||
| "clang-tidy==20.1.0", | ||
| "other-package==1.0.0", | ||
| ] | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -132,7 +134,9 @@ def test_get_version_from_dependency_missing_file(): | |
| @pytest.mark.benchmark | ||
| def test_get_version_from_dependency_missing_dependency(): | ||
| """Test get_version_from_dependency with missing dependency.""" | ||
| mock_toml_content = {"project": {"dependencies": ["other-package==1.0.0"]}} | ||
| mock_toml_content = { | ||
| "project": {"optional-dependencies": {"tools": ["other-package==1.0.0"]}} | ||
| } | ||
|
|
||
| with ( | ||
| patch("pathlib.Path.exists", return_value=True), | ||
|
|
@@ -155,6 +159,30 @@ def test_get_version_from_dependency_malformed_toml(): | |
| assert result is None | ||
|
|
||
|
|
||
| @pytest.mark.benchmark | ||
| def test_get_version_from_dependency_fallback_to_dependencies(): | ||
| """Test get_version_from_dependency falls back to project.dependencies.""" | ||
| mock_toml_content = { | ||
| "project": { | ||
| "dependencies": [ | ||
| "clang-format==20.1.7", | ||
| "clang-tidy==20.1.0", | ||
| "other-package==1.0.0", | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| with ( | ||
| patch("pathlib.Path.exists", return_value=True), | ||
| patch("cpp_linter_hooks.util.tomllib.load", return_value=mock_toml_content), | ||
| ): | ||
| result = get_version_from_dependency("clang-format") | ||
| assert result == "20.1.7" | ||
|
|
||
| result = get_version_from_dependency("clang-tidy") | ||
| assert result == "20.1.0" | ||
|
|
||
|
||
|
|
||
| # Tests for _resolve_version | ||
| @pytest.mark.benchmark | ||
| @pytest.mark.parametrize( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.