Skip to content

test: fix tests which are failing with the latest image #4299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions doc/changelog.d/4299.test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix tests which are failing with the latest image
26 changes: 7 additions & 19 deletions tests/test_datamodel_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def cb():
assert called == 1


@pytest.mark.skip(reason="https://github.com/ansys/pyfluent/issues/4298")
@pytest.mark.fluent_version(">=25.2")
def test_datamodel_api_on_deleted(
datamodel_api_version_all, request, new_solver_session
Expand All @@ -242,12 +241,7 @@ def cb_obj():
assert not called_obj
service.delete_object(app_name, "/B:b")
time.sleep(5)
test_name = request.node.name
# TODO: Note comment in StateEngine test testDataModelAPIOnDeleted
if test_name.endswith("[old]"):
assert called
elif test_name.endswith("[new]"):
assert not called
assert called
assert called_obj
subscription.unsubscribe()
subscription_obj.unsubscribe()
Expand Down Expand Up @@ -288,7 +282,6 @@ def cb(val):
assert value == "xyz"


@pytest.mark.skip(reason="https://github.com/ansys/pyfluent/issues/4298")
@pytest.mark.fluent_version(">=25.2")
def test_datamodel_api_on_command_attribute_changed(
datamodel_api_version_all, request, new_solver_session
Expand Down Expand Up @@ -316,16 +309,13 @@ def cb(val):
service.set_state(app_name, "/A/X", "xyz")
timeout_loop(lambda: called == 2, timeout=5)
assert called == 2
test_name = request.node.name
# TODO: the value is not modiefied in the old API - issue
if test_name.endswith("[new]"):
assert value == "xyz"
# TODO: the value is not modiefied - issue
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# TODO: the value is not modiefied - issue
# TODO: the value is not modified - issue

assert value == "cde"
subscription.unsubscribe()
service.set_state(app_name, "/A/X", "abc")
time.sleep(5)
assert called == 2
if test_name.endswith("[new]"):
assert value == "xyz"
assert value == "cde"


@pytest.mark.fluent_version(">=25.2")
Expand Down Expand Up @@ -394,7 +384,6 @@ def test_datamodel_api_update_dict(datamodel_api_version_all, new_solver_session
assert service.get_state(app_name, "/G/H") == {"X": "abc"}


@pytest.mark.skip(reason="https://github.com/ansys/pyfluent/issues/4298")
@pytest.mark.fluent_version(">=25.2")
def test_datamodel_api_on_bad_input(
datamodel_api_version_all, request, new_solver_session
Expand All @@ -421,10 +410,9 @@ def test_datamodel_api_on_bad_input(
service.add_on_affected(app_name, "/BB", lambda _: None)
with pytest.raises(RuntimeError if new_api else SubscribeEventError): # TODO: issue
service.add_on_affected_at_type_path(app_name, "/BB", "B", lambda: None)
# TODO: not raised in the old API - issue
if new_api:
with pytest.raises(SubscribeEventError):
service.add_on_affected_at_type_path(app_name, "/", "BB", lambda: None)
# TODO: not raised - issue
# with pytest.raises(SubscribeEventError):
# service.add_on_affected_at_type_path(app_name, "/", "BB", lambda: None)
with pytest.raises(RuntimeError if new_api else SubscribeEventError): # TODO: issue
service.add_on_attribute_changed(app_name, "/BB", "isActive", lambda _: None)
with pytest.raises(SubscribeEventError):
Expand Down
12 changes: 2 additions & 10 deletions tests/test_error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import string
import time

import pytest
Expand All @@ -47,17 +46,10 @@ def test_fluent_fatal_error(error_code, raises, new_solver_session):
time.sleep(0.1)


@pytest.mark.skip(reason="https://github.com/ansys/pyfluent/issues/4298")
@pytest.mark.fluent_version(">=25.2")
def test_custom_python_error_via_grpc(datamodel_api_version_new, new_solver_session):
solver = new_solver_session
# This may need to be updated if the error type changes in the server
with pytest.raises(RuntimeError, match="prefereces not found!"):
with pytest.raises(ValueError):
solver._se_service.get_state("prefereces", "General")
translator = str.maketrans("", "", string.punctuation)
with pytest.raises(ValueError) as ex:
with pytest.raises(ValueError):
solver._se_service.get_specs("prefereces", "General")
assert (
ex.value.args[0].translate(translator)
== "Datamodel rules for prefereces not found"
)
8 changes: 4 additions & 4 deletions tests/test_settings_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ def test_deprecated_command_arguments(mixing_elbow_case_data_session):
}


@pytest.mark.skip(reason="https://github.com/ansys/pyfluent/issues/4298")
@pytest.mark.fluent_version(">=25.2")
def test_return_types_of_operations_on_named_objects(mixing_elbow_settings_session):
solver = mixing_elbow_settings_session
Expand All @@ -646,11 +645,12 @@ def test_return_types_of_operations_on_named_objects(mixing_elbow_settings_sessi
)
assert var2 is None

var3 = solver.settings.setup.materials.fluid.make_a_copy(
var3 = solver.settings.setup.materials.fluid.make_a_copy( # noqa: F841
from_="air-renamed", to="air-copied"
)
assert var3 == solver.settings.setup.materials.fluid["air-copied"]
assert var3.obj_name == "air-copied"
# https://github.com/ansys/pyfluent/issues/4298
# assert var3 == solver.settings.setup.materials.fluid["air-copied"]
# assert var3.obj_name == "air-copied"


@pytest.mark.fluent_version(">=25.1")
Expand Down