Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit b603919

Browse files
authored
Remove get_changes_using_rust usage (#1164)
1 parent 58d4301 commit b603919

2 files changed

Lines changed: 1 addition & 43 deletions

File tree

services/comparison/__init__.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import sentry_sdk
66
from asgiref.sync import async_to_sync
7-
from shared.reports.changes import get_changes_using_rust, run_comparison_using_rust
7+
from shared.reports.changes import run_comparison_using_rust
88
from shared.reports.types import Change, ReportTotals
99
from shared.torngit.base import TorngitBaseAdapter
1010
from shared.torngit.exceptions import TorngitClientGeneralError
@@ -169,31 +169,6 @@ def get_changes(self) -> list[Change] | None:
169169
self.comparison.head.report,
170170
diff,
171171
)
172-
if (
173-
self._changes
174-
and self.comparison.project_coverage_base.report is not None
175-
and self.comparison.head.report is not None
176-
and self.comparison.project_coverage_base.report.rust_report is not None
177-
and self.comparison.head.report.rust_report is not None
178-
):
179-
rust_changes = get_changes_using_rust(
180-
self.comparison.project_coverage_base.report,
181-
self.comparison.head.report,
182-
diff,
183-
)
184-
original_paths = set([c.path for c in self._changes])
185-
new_paths = set([c.path for c in rust_changes])
186-
if original_paths != new_paths:
187-
only_on_new = sorted(new_paths - original_paths)
188-
only_on_original = sorted(original_paths - new_paths)
189-
log.info(
190-
"There are differences between python changes and rust changes",
191-
extra=dict(
192-
only_on_new=only_on_new[:100],
193-
only_on_original=only_on_original[:100],
194-
repoid=self.head.commit.repoid,
195-
),
196-
)
197172

198173
return self._changes
199174

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from shared.reports.types import Change
2-
31
from services.comparison import ComparisonProxy, FilteredComparison
42

53

@@ -14,18 +12,3 @@ def test_get_existing_statuses(self, mocker):
1412
assert isinstance(filtered_comparison, FilteredComparison)
1513
res = filtered_comparison.get_existing_statuses()
1614
assert res == mocked_get_existing_statuses.return_value
17-
18-
def test_get_changes_rust_vs_python(self, mocker):
19-
mocker.patch.object(ComparisonProxy, "get_diff")
20-
mocker.patch(
21-
"services.comparison.get_changes",
22-
return_value=[Change(path="apple"), Change(path="pear")],
23-
)
24-
mocker.patch(
25-
"services.comparison.get_changes_using_rust",
26-
return_value=[Change(path="banana"), Change(path="pear")],
27-
)
28-
comparison = ComparisonProxy(mocker.MagicMock())
29-
res = comparison.get_changes()
30-
expected_result = [Change(path="apple"), Change(path="pear")]
31-
assert expected_result == res

0 commit comments

Comments
 (0)