Skip to content

Commit

Permalink
Fixing unittests on python 3.12
Browse files Browse the repository at this point in the history
[CLOUDDST-24653]
  • Loading branch information
lipoja committed Nov 13, 2024
1 parent 6cc9473 commit b01a2f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions tests/test_workers/test_tasks/test_build_merge_index_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
@mock.patch('iib.workers.tasks.build_merge_index_image.create_dockerfile')
@mock.patch('iib.workers.tasks.build._get_index_database')
@mock.patch('iib.workers.tasks.build_merge_index_image.opm_migrate')
@mock.patch('iib.workers.tasks.build_merge_index_image.opm_registry_add_fbc')
@mock.patch('iib.workers.tasks.build_merge_index_image._push_image')
@mock.patch('iib.workers.tasks.build_merge_index_image._build_image')
@mock.patch('iib.workers.tasks.build_merge_index_image.deprecate_bundles_fbc')
Expand Down Expand Up @@ -66,7 +65,6 @@ def test_handle_merge_request(
mock_dep_b_fbc,
mock_bi,
mock_pi,
mock_oraf,
mock_om,
mock_gid,
mock_ogd,
Expand Down Expand Up @@ -135,8 +133,8 @@ def side_effect(*args, base_dir, **kwargs):
binary_image_config=binary_image_config,
)

mock_om.called_once()
mock_oraf.called_once()
if target_fbc:
mock_om.assert_called_once()

assert mock_cleanup.call_count == 2
mock_prfb.assert_called_once_with(
Expand Down Expand Up @@ -193,7 +191,6 @@ def side_effect(*args, base_dir, **kwargs):
@mock.patch('iib.workers.tasks.build_merge_index_image.create_dockerfile')
@mock.patch('iib.workers.tasks.build._get_index_database')
@mock.patch('iib.workers.tasks.build_merge_index_image.opm_migrate')
@mock.patch('iib.workers.tasks.build_merge_index_image.opm_registry_add_fbc')
@mock.patch('iib.workers.tasks.build_merge_index_image._create_and_push_manifest_list')
@mock.patch('iib.workers.tasks.build_merge_index_image._push_image')
@mock.patch('iib.workers.tasks.build_merge_index_image._build_image')
Expand Down Expand Up @@ -232,7 +229,6 @@ def test_handle_merge_request_no_deprecate(
mock_bi,
mock_pi,
mock_capml,
mock_oraf,
mock_om,
mock_gid,
mock_ogd,
Expand Down Expand Up @@ -282,8 +278,8 @@ def test_handle_merge_request_no_deprecate(
distribution_scope='stage',
)

mock_om.called_once()
mock_oraf.called_once()
if target_fbc:
mock_om.assert_called_once()

assert mock_cleanup.call_count == 2
mock_prfb.assert_called_once_with(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_workers/test_tasks/test_fbc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_merge_catalogs_dirs(mock_enforce_json, mock_rc, mock_opm, tmpdir):

merge_catalogs_dirs(src_config=source_dir, dest_config=destination_dir)
mock_enforce_json.assert_called_once_with(destination_dir)
mock_rc.called_once_with(
mock_rc.assert_called_once_with(
[mock_opm.opm_version, 'validate', destination_dir],
exc_msg=f'Failed to validate the content from config_dir {destination_dir}',
)
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_merge_catalogs_dirs_raise(mock_isdir, mock_cpt, tmpdir):
with pytest.raises(IIBError, match=f"config directory does not exist: {source_dir}"):
merge_catalogs_dirs(src_config=source_dir, dest_config=destination_dir)

mock_cpt.not_called()
mock_cpt.assert_not_called()


def test_enforce_json_config_dir(tmpdir):
Expand Down

0 comments on commit b01a2f9

Please sign in to comment.