Skip to content

Commit

Permalink
tests: unit: package_managers: yarn: Fix mock assert called_once
Browse files Browse the repository at this point in the history
Python 3.12 (not officially supported by cachi2) fails on the
    test_main.py::test_set_yarnrc_configuration

unit tests with the following error:
    AttributeError: 'called_once' is not a valid assertion. Use a spec
    for the mock if 'called_once' is meant to be an attribute.

Indeed, the proper way of handling this assertion is:
    mock_obj.assert_called_once()

Signed-off-by: Erik Skultety <eskultet@redhat.com>
  • Loading branch information
eskultety committed May 13, 2024
1 parent f173f62 commit 64b4e10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/unit/package_managers/yarn/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def test_set_yarnrc_configuration(
}

assert yarn_rc._data == expected_data
assert mock_write.called_once()
mock_write.assert_called_once()


def test_verify_yarnrc_paths() -> None:
Expand Down

0 comments on commit 64b4e10

Please sign in to comment.