File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def get_version_from_dependency(tool: str) -> Optional[str]:
2121 with open (pyproject_path , "rb" ) as f :
2222 data = tomllib .load (f )
2323 # Check dependencies
24- dependencies = data .get ("dependencies" , [])
24+ dependencies = data .get ("project" , {}). get ( " dependencies" , [])
2525 for dep in dependencies :
2626 if dep .startswith (f"{ tool } ==" ):
2727 return dep .split ("==" )[1 ]
Original file line number Diff line number Diff line change 2525def test_get_version_from_dependency_success ():
2626 """Test get_version_from_dependency with valid pyproject.toml."""
2727 mock_toml_content = {
28- "dependencies" : [
29- "clang-format==20.1.7" ,
30- "clang-tidy==20.1.0" ,
31- "other-package==1.0.0" ,
32- ],
28+ "project" : {
29+ "dependencies" : [
30+ "clang-format==20.1.7" ,
31+ "clang-tidy==20.1.0" ,
32+ "other-package==1.0.0" ,
33+ ]
34+ }
3335 }
3436
3537 with (
@@ -54,7 +56,7 @@ def test_get_version_from_dependency_missing_file():
5456@pytest .mark .benchmark
5557def test_get_version_from_dependency_missing_dependency ():
5658 """Test get_version_from_dependency with missing dependency."""
57- mock_toml_content = {"dependencies" : ["other-package==1.0.0" ]}
59+ mock_toml_content = {"project" : { " dependencies" : ["other-package==1.0.0" ]} }
5860
5961 with (
6062 patch ("pathlib.Path.exists" , return_value = True ),
You can’t perform that action at this time.
0 commit comments