Skip to content

Commit

Permalink
Split asserts combined with and for better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Jan 6, 2025
1 parent 7b8daee commit 2d1fd06
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion tests/ert/ui_tests/gui/test_full_manual_update_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def test_manual_analysis_workflow(ensemble_experiment_has_run, qtbot):
tree_view.expandAll()

model = tree_view.model()
assert model is not None and model.rowCount() == 1
assert model is not None
assert model.rowCount() == 1
assert "iter-0_1" in model.index(1, 0, model.index(0, 0)).data(0)

experiments_panel.close()
Expand Down
6 changes: 4 additions & 2 deletions tests/ert/unit_tests/config/test_queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def test_project_code_is_set_when_forward_model_contains_selected_simulator(
project_code = queue_config.queue_options.project_code

assert project_code is not None
assert "flow" in project_code and "rms" in project_code
assert "flow" in project_code
assert "rms" in project_code


@pytest.mark.parametrize("queue_system", ["LSF", "TORQUE", "SLURM"])
Expand Down Expand Up @@ -175,7 +176,8 @@ def test_that_overwriting_QUEUE_OPTIONS_warns(
assert (
f"Overwriting QUEUE_OPTION {queue_system} {queue_system_option}: \n Old value:"
" test_0 \n New value: test_1"
) in caplog.text and (
) in caplog.text
assert (
f"Overwriting QUEUE_OPTION {queue_system} MAX_RUNNING: \n Old value:"
" 10 \n New value: 10"
) not in caplog.text
Expand Down
6 changes: 4 additions & 2 deletions tests/ert/unit_tests/resources/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,11 @@ def test_that_delete_file_deletes_broken_symlinks():

delete_file("file")
assert not Path("file").exists()
assert Path("link").is_symlink() and not Path("link").exists()
assert Path("link").is_symlink()
assert not Path("link").exists()
delete_file("link")
assert not Path("link").is_symlink() and not Path("link").exists()
assert not Path("link").is_symlink()
assert not Path("link").exists()


@pytest.mark.usefixtures("use_tmpdir")
Expand Down
3 changes: 2 additions & 1 deletion tests/ert/unit_tests/scheduler/test_lsf_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,8 @@ def mock_poll_once_by_bhist(*args, **kwargs):
await poll(driver, {0})
assert "bhist is used" in caplog.text
assert bhist_called
assert driver._bhist_cache and job_id in driver._bhist_cache
assert driver._bhist_cache
assert job_id in driver._bhist_cache


@pytest.mark.integration_test
Expand Down
3 changes: 2 additions & 1 deletion tests/ert/unit_tests/scheduler/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ async def test_add_dispatch_information_to_jobs_file(
assert content["real_id"] == realization.iens
assert content["dispatch_url"] == test_ee_uri
assert content["ee_token"] == test_ee_token
assert type(content["jobList"]) == list and len(content["jobList"]) == 0
assert type(content["jobList"]) == list
assert len(content["jobList"]) == 0


@pytest.mark.parametrize("max_submit", [1, 2, 3])
Expand Down

0 comments on commit 2d1fd06

Please sign in to comment.