diff --git a/src/ansys/dpf/core/server_types.py b/src/ansys/dpf/core/server_types.py index 0c43cd34f43..02462bb870f 100644 --- a/src/ansys/dpf/core/server_types.py +++ b/src/ansys/dpf/core/server_types.py @@ -146,7 +146,10 @@ def _run_launch_server_process( AvailableServerContexts.entry, AvailableServerContexts.premium, ): - run_cmd.append(f"--context {int(context.licensing_context_type)}") + if context.licensing_context_type == 2 and len(context.xml_path) > 0: # 2 == custom xml + run_cmd.append(f"--context {context.xml_path}") + else: + run_cmd.append(f"--context {int(context.licensing_context_type)}") if grpc_mode == server_factory.GrpcMode.Insecure: run_cmd.append("--mode 0") diff --git a/tests/test_server.py b/tests/test_server.py index 91d41aa4ee9..dd1fcafe3b1 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -184,6 +184,19 @@ def test_server_context_custom_xml(remote_config_server_type, testfiles_dir): assert sorted(list(server_plugins.keys())) == ref +@pytest.mark.skipif( + not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0, reason="not working properly before 25R2" +) +@pytest.mark.skipif(running_docker, reason="server start using custom xml not working on Docker") +def test_server_context_custom_xml_check_operators(remote_config_server_type): + from pathlib import Path + + context = dpf.core.AvailableServerContexts.no_context + context.xml_path = Path(dpf.core.misc.get_ansys_path()) / "dpf" / "utilities" / "DpfEmpty.xml" + server = start_local_server(config=remote_config_server_type, context=context, as_global=False) + assert len(server.plugins) == 1 + + @pytest.mark.skipif( os.name == "posix" or running_docker, reason="lin issue: 2 processes can be run with same port",