From 90c5bcdacbbb6e29e574fc0456814efbffd13c34 Mon Sep 17 00:00:00 2001 From: german Date: Tue, 19 Mar 2024 19:47:50 +0000 Subject: [PATCH] Ignoring pymapdl_start_instance env var on CLI --- src/ansys/mapdl/core/cli.py | 4 ++++ tests/test_cli.py | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ansys/mapdl/core/cli.py b/src/ansys/mapdl/core/cli.py index c0400e645a..208df4033f 100644 --- a/src/ansys/mapdl/core/cli.py +++ b/src/ansys/mapdl/core/cli.py @@ -470,6 +470,10 @@ def start( + " The following argument is not allowed in CLI: 'license_server_check'.\nIgnoring argument." ) + # Ignoring env var if using CLI + if "PYMAPDL_START_INSTANCE" in os.environ: + os.environ.pop("PYMAPDL_START_INSTANCE") + out = launch_mapdl( exec_file=exec_file, just_launch=True, diff --git a/tests/test_cli.py b/tests/test_cli.py index 9fd8b55602..e53b47c827 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -54,7 +54,13 @@ def do_run(arguments=""): @requires("click") @requires("local") @requires("nostudent") -def test_launch_mapdl_cli(run_cli): +@pytest.mark.parametrize("start_instance", [None, True, False] ) +def test_launch_mapdl_cli(monkeypatch, run_cli, start_instance): + if start_instance is not None: + monkeypatch.setenv("PYMAPDL_START_INSTANCE", str(start_instance)) + else: + monkeypatch.unset("PYMAPDL_START_INSTANCE") + output = run_cli() # In local