diff --git a/integration_tests/test_codemod_urls.py b/integration_tests/test_codemod_urls.py index 4b3470ab..a7795e32 100644 --- a/integration_tests/test_codemod_urls.py +++ b/integration_tests/test_codemod_urls.py @@ -17,7 +17,6 @@ async def visit_url(client, url): return url, None -@pytest.mark.asyncio async def check_accessible_urls(urls): async with httpx.AsyncClient() as client: tasks = [visit_url(client, url) for url in urls] @@ -36,6 +35,7 @@ async def check_accessible_urls(urls): @pytest.mark.asyncio +@pytest.mark.skip(reason="Flaky test, needs investigation") async def test_codemod_reference_urls(): urls = list( set( @@ -50,6 +50,7 @@ async def test_codemod_reference_urls(): @pytest.mark.asyncio +@pytest.mark.skip(reason="Flaky test, needs investigation") async def test_tool_rules_urls(): urls = [ rule.url diff --git a/src/codemodder/codetf/v3/codetf.py b/src/codemodder/codetf/v3/codetf.py index 5bc81264..5653b977 100644 --- a/src/codemodder/codetf/v3/codetf.py +++ b/src/codemodder/codetf/v3/codetf.py @@ -8,7 +8,6 @@ from ..common import Change, CodeTFWriter, Finding, FixQuality from ..v2.codetf import AIMetadata as AIMetadatav2 from ..v2.codetf import CodeTF as CodeTFv2 -from ..v2.codetf import Finding as V2Finding from ..v2.codetf import Result from ..v2.codetf import Run as Runv2 @@ -99,7 +98,7 @@ class FixMetadata(BaseModel): class FixResult(BaseModel): """Result corresponding to a single finding""" - finding: Finding | V2Finding + finding: Finding fixStatus: FixStatus changeSets: list[ChangeSet] = [] fixMetadata: Optional[FixMetadata] = None @@ -174,7 +173,7 @@ def from_v2_result(result: Result) -> list[FixResult]: ) fix_results.append( FixResult( - finding=f, + finding=Finding(**f.model_dump()), fixStatus=FixStatus(status=FixStatusType.fixed), changeSets=[changeset], fixMetadata=fix_metadata, @@ -185,7 +184,7 @@ def from_v2_result(result: Result) -> list[FixResult]: for f in result.unfixedFindings or []: fix_results.append( FixResult( - finding=f, + finding=Finding(**f.model_dump()), fixStatus=FixStatus(status=FixStatusType.failed, reason=f.reason), ) ) diff --git a/tests/test_codetf.py b/tests/test_codetf.py index c5e64e1e..f23b7360 100644 --- a/tests/test_codetf.py +++ b/tests/test_codetf.py @@ -274,8 +274,8 @@ def test_v2_to_v3_conversion(): # correctly associates findings to the change assert f.changeSets and f.changeSets[0].path == v2changeset.path assert f.changeSets and f.changeSets[0].diff == v2changeset.diff - assert isinstance(f.finding, Finding) and f.changeSets[0].changes == [ - v2_finding_to_change[f.finding].to_common() + assert isinstance(f.finding, FindingV3) and f.changeSets[0].changes == [ + v2_finding_to_change[Finding(**f.finding.model_dump())].to_common() ] # unfixed metadata @@ -283,4 +283,4 @@ def test_v2_to_v3_conversion(): unfixed[0].fixStatus.reason and unfixed[0].fixStatus.reason == v2_unfixed[0].reason ) - assert unfixed[0].finding == v2_unfixed[0] + assert unfixed[0].finding == FindingV3(**v2_unfixed[0].model_dump())