From 7e00448f35636378ffc1ef126bbf65af8a218ee3 Mon Sep 17 00:00:00 2001 From: Mohamed Koubaa Date: Mon, 6 Jan 2025 14:38:36 -0600 Subject: [PATCH 1/6] check --- .github/workflows/ci_cd.yml | 2 +- tests/conftest.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 584b1920b..315967e31 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -358,7 +358,7 @@ jobs: name: Embedding scripts testing and coverage runs-on: ubuntu-latest timeout-minutes: 10 - needs: [smoke-tests, revn-variations] + needs: [revn-variations] container: image: ${{ needs.revn-variations.outputs.test_container }} options: --entrypoint /bin/bash diff --git a/tests/conftest.py b/tests/conftest.py index 6b19895be..7fc00bd74 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -176,7 +176,7 @@ def mke_app_reset(request): EMBEDDED_APP.new() -_CHECK_PROCESS_RETURN_CODE = os.name == "nt" +_CHECK_PROCESS_RETURN_CODE = True # set to True if you want to see all the subprocess stdout/stderr _PRINT_SUBPROCESS_OUTPUT_TO_CONSOLE = False From e2a3505fa4667283c2562ba3ba6fda0685cbb537 Mon Sep 17 00:00:00 2001 From: Mohamed Koubaa Date: Mon, 6 Jan 2025 14:50:48 -0600 Subject: [PATCH 2/6] no crash on exit for 25.1 --- .github/workflows/ci_cd.yml | 2 +- tests/conftest.py | 4 +--- tests/embedding/test_logger.py | 8 +++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 315967e31..584b1920b 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -358,7 +358,7 @@ jobs: name: Embedding scripts testing and coverage runs-on: ubuntu-latest timeout-minutes: 10 - needs: [revn-variations] + needs: [smoke-tests, revn-variations] container: image: ${{ needs.revn-variations.outputs.test_container }} options: --entrypoint /bin/bash diff --git a/tests/conftest.py b/tests/conftest.py index 7fc00bd74..be8cafc65 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -176,8 +176,6 @@ def mke_app_reset(request): EMBEDDED_APP.new() -_CHECK_PROCESS_RETURN_CODE = True - # set to True if you want to see all the subprocess stdout/stderr _PRINT_SUBPROCESS_OUTPUT_TO_CONSOLE = False @@ -186,7 +184,7 @@ def mke_app_reset(request): def run_subprocess(): def func(args, env=None, check: bool = None): if check is None: - check = _CHECK_PROCESS_RETURN_CODE + check = True process, output = ansys.mechanical.core.run._run( args, env, check, _PRINT_SUBPROCESS_OUTPUT_TO_CONSOLE ) diff --git a/tests/embedding/test_logger.py b/tests/embedding/test_logger.py index 76242b671..c0ef1435f 100644 --- a/tests/embedding/test_logger.py +++ b/tests/embedding/test_logger.py @@ -57,14 +57,16 @@ def _run_embedding_log_test( embedded_py = os.path.join(rootdir, "tests", "scripts", "embedding_log_test.py") subprocess_pass_expected = pass_expected - if pass_expected == True and os.name != "nt" and int(version) < 251: - subprocess_pass_expected = False + if pass_expected == True: + if os.name != "nt" and int(version) < 251: + subprocess_pass_expected = False - process, stdout, stderr = run_subprocess( + _, stdout, stderr = run_subprocess( [sys.executable, embedded_py, version, testname], _get_env_without_logging_variables(), subprocess_pass_expected, ) + if not subprocess_pass_expected: stdout = stdout.decode() _assert_success(stdout, pass_expected) From 7bf41917cdf59887cdb20f20d09fc3b80db89cf2 Mon Sep 17 00:00:00 2001 From: Mohamed Koubaa Date: Tue, 7 Jan 2025 07:14:32 -0600 Subject: [PATCH 3/6] don't check return code for <251 on linux --- tests/conftest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index be8cafc65..0cf016b3a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -181,10 +181,14 @@ def mke_app_reset(request): @pytest.fixture() -def run_subprocess(): +def run_subprocess(pytestconfig): + version = pytestconfig.getoption("ansys_version") def func(args, env=None, check: bool = None): if check is None: check = True + if os.name != "nt": + if version < 251: + check = False process, output = ansys.mechanical.core.run._run( args, env, check, _PRINT_SUBPROCESS_OUTPUT_TO_CONSOLE ) From 3bf6c242a83f257f27ab6f6ca1efdc7efa406fd4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 13:15:08 +0000 Subject: [PATCH 4/6] chore: auto fixes from pre-commit hooks --- tests/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/conftest.py b/tests/conftest.py index 0cf016b3a..0a761abf7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -183,6 +183,7 @@ def mke_app_reset(request): @pytest.fixture() def run_subprocess(pytestconfig): version = pytestconfig.getoption("ansys_version") + def func(args, env=None, check: bool = None): if check is None: check = True From 6c28afda398191fae59f9890c4ee0d2243924e3c Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 7 Jan 2025 13:41:35 +0000 Subject: [PATCH 5/6] chore: adding changelog file 1029.fixed.md [dependabot-skip] --- doc/changelog.d/1029.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/1029.fixed.md diff --git a/doc/changelog.d/1029.fixed.md b/doc/changelog.d/1029.fixed.md new file mode 100644 index 000000000..7996cc7e0 --- /dev/null +++ b/doc/changelog.d/1029.fixed.md @@ -0,0 +1 @@ +Process return code \ No newline at end of file From dd744d3188dfbce00c90cd67c4d976b7bdef0094 Mon Sep 17 00:00:00 2001 From: Mohamed Koubaa Date: Tue, 7 Jan 2025 07:42:26 -0600 Subject: [PATCH 6/6] fix version check --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0cf016b3a..a08ce1aa1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -187,7 +187,7 @@ def func(args, env=None, check: bool = None): if check is None: check = True if os.name != "nt": - if version < 251: + if int(version) < 251: check = False process, output = ansys.mechanical.core.run._run( args, env, check, _PRINT_SUBPROCESS_OUTPUT_TO_CONSOLE