Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Flake8](https://img.shields.io/badge/Flake8-passed-brightgreen)](https://github.com/RuminantFarmSystems/MASM/actions/workflows/combined_format_lint_test_mypy.yml)
[![Pytest](https://img.shields.io/badge/Pytest-failed-red)](https://github.com/RuminantFarmSystems/MASM/actions/workflows/combined_format_lint_test_mypy.yml)
[![Coverage](https://img.shields.io/badge/Coverage-%25-red)](https://github.com/RuminantFarmSystems/MASM/actions/workflows/combined_format_lint_test_mypy.yml)
[![Pytest](https://img.shields.io/badge/Pytest-passed-brightgreen)](https://github.com/RuminantFarmSystems/MASM/actions/workflows/combined_format_lint_test_mypy.yml)
[![Coverage](https://img.shields.io/badge/Coverage-99%25-brightgreen)](https://github.com/RuminantFarmSystems/MASM/actions/workflows/combined_format_lint_test_mypy.yml)
[![Mypy](https://img.shields.io/badge/Mypy-1164%20errors-red)](https://github.com/RuminantFarmSystems/MASM/actions/workflows/combined_format_lint_test_mypy.yml)


Expand Down
18 changes: 0 additions & 18 deletions RUFAS/e2e_test_results_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,24 +691,6 @@ def update_expected_test_results(output_dir: Path, output_prefix: str) -> None:
with open(expected_results_path, "r") as expected_results_file:
expected_results = json.load(expected_results_file)

diff = DeepDiff(
expected_results["expected_results"], actual_results, ignore_order=True, verbose_level=2
)
is_difference_in_results: bool = False if (diff == {}) else True
if is_difference_in_results:
om.add_warning(
"End-to-end testing expected results different from new actual results",
f"Differences will be saved in {output_dir} for {path_set.domain} domain.",
info_map,
)
save_path = output_dir / f"{path_set.domain}_update_diff.json"
om.dict_to_file_json(data_dict=diff, path=save_path)
else:
om.add_log(
"End-to-end testing expected results matched new actual results",
f"No differences detected in actual and expected results for {path_set.domain} domain.",
info_map,
)
minified_actual_results = Utility.make_serializable(
actual_results, max_depth=om.JSON_OUTPUT_MAX_RECURSIVE_DEPTH
)
Expand Down
1 change: 1 addition & 0 deletions changelog_WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,4 @@ This **WIP Changelog** records development changes in progress and not yet inclu
- [3235](https://github.com/RuminantFarmSystems/RuFaS/pull/3235) - [minor change] [Dependabot] [NoInputChange] [NoOutputChange] Updates file-target of dependabot-change PRs for tagging dev-team members for review.
- [3256](https://github.com/RuminantFarmSystems/RuFaS/pull/3256) - [minor change] [Branch Alignment] [NoInputChange] [NoOutputChange] Aligning `dev` branch with bug-fixing code from PR 3214 that was merged into `test`.
- [3260](https://github.com/RuminantFarmSystems/RuFaS/pull/3260) - [minor change] [OutputManager] [NoInputChange] [NoOutputChange] Removes duplicative `report` naming mechanism in `OutputManager`.
- [3275](https://github.com/RuminantFarmSystems/RuFaS/pull/3260) - [minor change] [E2E Testing] [NoInputChange] [NoOutputChange] Removes `deepdiff` check from the process to update e2e expected results.
19 changes: 7 additions & 12 deletions tests/test_e2e_test_results_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,19 +495,18 @@ def test_filter_nested() -> None:


@pytest.mark.parametrize(
"diff, should_update, matching_path, raise_exception",
"diff, matching_path, raise_exception",
[
({}, False, "output_dir/actual_results.json", None),
({"diff": "some_differences"}, True, "output_dir/actual_results.json", None),
({}, False, None, None),
({}, False, "output_dir/actual_results.json", IOError("File read error")),
({}, False, "output_dir/actual_results.json", json.JSONDecodeError("Invalid JSON", doc="", pos=0)),
({}, "output_dir/actual_results.json", None),
({"diff": "some_differences"}, "output_dir/actual_results.json", None),
({}, None, None),
({}, "output_dir/actual_results.json", IOError("File read error")),
({}, "output_dir/actual_results.json", json.JSONDecodeError("Invalid JSON", doc="", pos=0)),
],
)
def test_update_expected_test_results(
mocker: MockerFixture,
diff: dict[str, str],
should_update: bool,
matching_path: str | None,
raise_exception: Exception | None,
) -> None:
Expand All @@ -516,7 +515,6 @@ def test_update_expected_test_results(
output_dir = Path("output_dir")
mocker.patch("RUFAS.e2e_test_results_handler.OutputManager.__init__", return_value=None)
add_log = mocker.patch("RUFAS.e2e_test_results_handler.OutputManager.add_log")
add_warning = mocker.patch("RUFAS.e2e_test_results_handler.OutputManager.add_warning")
add_error = mocker.patch("RUFAS.e2e_test_results_handler.OutputManager.add_error")

results_path = mocker.MagicMock()
Expand Down Expand Up @@ -564,11 +562,8 @@ def test_update_expected_test_results(
mock_move.assert_called_once_with(Path(expected_backup_path), results_path.expected_results_path)
else:
assert add_error.call_count == 0
expected_log_count = 3 if should_update else 2
assert add_log.call_count == expected_log_count
assert add_log.call_count == 1
mock_write_json.assert_called_once()
if diff:
add_warning.assert_called_once()
else:
assert add_error.call_count == 1
assert add_log.call_count == 1
Expand Down