File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ def get_version_from_dependency(tool: str) -> Optional[str]:
2020 return None
2121 with open (pyproject_path , "rb" ) as f :
2222 data = tomllib .load (f )
23- # Check dependencies
24- dependencies = data .get ("dependencies" , [])
23+ # Check [project]. 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- ],
33- "project" : {},
28+ "project" : {
29+ "dependencies" : [
30+ "clang-format==20.1.7" ,
31+ "clang-tidy==20.1.0" ,
32+ "other-package==1.0.0" ,
33+ ]
34+ }
3435 }
3536
3637 with (
@@ -55,7 +56,7 @@ def test_get_version_from_dependency_missing_file():
5556@pytest .mark .benchmark
5657def test_get_version_from_dependency_missing_dependency ():
5758 """Test get_version_from_dependency with missing dependency."""
58- mock_toml_content = {"build-system " : {"requires " : ["other-package==1.0.0" ]}}
59+ mock_toml_content = {"project " : {"dependencies " : ["other-package==1.0.0" ]}}
5960
6061 with (
6162 patch ("pathlib.Path.exists" , return_value = True ),
You can’t perform that action at this time.
0 commit comments