From 12a7f23200d113aed30ddbbc3082d387556a0cf5 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:04:44 +0100 Subject: [PATCH 1/8] chore: registering markers --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7063ddf067a..59b89ec96e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -132,7 +132,8 @@ filterwarnings = [ ] markers = [ "skip_grpc: skip tests using grpc", - "gui: skip tests that launch the GUI interface", + "requires_gui: skip tests that launch the GUI interface", + "console: run console test based", ] testpaths = "tests" image_cache_dir = "tests/.image_cache" From a750e5408bc07c3456ea5b2dabc10ae0025ab800 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:05:05 +0100 Subject: [PATCH 2/8] refactor: removing pytest warning --- tests/conftest.py | 2 +- tests/test_launcher.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4742b6326ce..7937f37cb3a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -316,7 +316,7 @@ def short_test_summary(self): ) -@pytest.mark.trylast +@pytest.hookimpl(trylast=True) def pytest_configure(config): vanilla_reporter = config.pluginmanager.getplugin("terminalreporter") my_reporter = MyReporter(config) diff --git a/tests/test_launcher.py b/tests/test_launcher.py index 4633a3f029d..3c2220847b9 100644 --- a/tests/test_launcher.py +++ b/tests/test_launcher.py @@ -345,7 +345,7 @@ def test_env_injection(): [None, False, "Working directory is NOT in the pytest directory."], [True, None, "There is a result file, and WDIR is a temp dir."], pytest.param( - True, True, "Both options (`True`) is not allowed.", marks=pytest.mark.fail + True, True, "Both options (`True`) is not allowed.", marks=pytest.mark.xfail ), [True, False, "There is a result file, and WDIR is in a temp dir."], [False, None, "There is NOT a result file, and WDIR is in a temp dir."], From a59b49f58427443a168655b00c023befa266ebf3 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:06:24 +0100 Subject: [PATCH 3/8] refactor: better description in marker --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 59b89ec96e7..524be007d34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -132,7 +132,7 @@ filterwarnings = [ ] markers = [ "skip_grpc: skip tests using grpc", - "requires_gui: skip tests that launch the GUI interface", + "requires_gui: run tests that require to launch the GUI interface", "console: run console test based", ] testpaths = "tests" From e0502fb0ca7e82455866841e33ea00d27417c427 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:14:57 +0100 Subject: [PATCH 4/8] feat: using strict markers --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 524be007d34..dd100fd8185 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -119,7 +119,7 @@ pymapdl_convert_script = "ansys.mapdl.core.cli:old_pymapdl_convert_script_entry_ pymapdl = "ansys.mapdl.core.cli:main" [tool.pytest.ini_options] -addopts = "-rxXsa -vvv --maxfail=10" +addopts = "-rxXsa -vvv --maxfail=10 --strict-markers" junit_family = "legacy" filterwarnings = [ "ignore::FutureWarning", From a9e81c6475ef6a841fdea07acf99e4f9bd40f60e Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 20 May 2025 07:29:50 +0000 Subject: [PATCH 5/8] chore: adding changelog file 3934.dependencies.md [dependabot-skip] --- doc/changelog.d/3934.dependencies.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/3934.dependencies.md diff --git a/doc/changelog.d/3934.dependencies.md b/doc/changelog.d/3934.dependencies.md new file mode 100644 index 00000000000..fbb73887833 --- /dev/null +++ b/doc/changelog.d/3934.dependencies.md @@ -0,0 +1 @@ +ci: using strict markers on pytest \ No newline at end of file From 2f06b5da17a55912660c8634e89871c252c9b5cd Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Tue, 20 May 2025 09:44:53 +0200 Subject: [PATCH 6/8] fix: add 'gui' marker for GUI test execution in pyproject.toml; update pytest arguments to enforce strict markers in workflows --- .github/workflows/test-local.yml | 2 +- .github/workflows/test-remote.yml | 2 +- pyproject.toml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-local.yml b/.github/workflows/test-local.yml index 0c58bb87e96..7157b93c324 100644 --- a/.github/workflows/test-local.yml +++ b/.github/workflows/test-local.yml @@ -120,7 +120,7 @@ jobs: TESTING_MINIMAL: ${{ inputs.testing-minimal }} P_SCHEMA: "/ansys_inc/v241/ansys/ac4/schema" PYTEST_TIMEOUT: 120 # seconds. Limit the duration for each unit test - PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests' + PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests --strict-markers' OMPI_ALLOW_RUN_AS_ROOT: 1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 diff --git a/.github/workflows/test-remote.yml b/.github/workflows/test-remote.yml index 499847e690e..e14219878f6 100644 --- a/.github/workflows/test-remote.yml +++ b/.github/workflows/test-remote.yml @@ -65,7 +65,7 @@ jobs: DPF_PORT: 21004 DPF_START_SERVER: False HAS_DPF: True - PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests' + PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests --strict-markers' MAPDL_PACKAGE: ghcr.io/ansys/mapdl steps: diff --git a/pyproject.toml b/pyproject.toml index 24530480b91..45f8db664c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -148,6 +148,7 @@ markers = [ "skip_grpc: skip tests using grpc", "requires_gui: run tests that require to launch the GUI interface", "console: run console test based", + "gui: run gui test", ] testpaths = "tests" From d70aed995265462c47d5fdbe35d183b64330e03c Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Tue, 20 May 2025 12:51:45 +0200 Subject: [PATCH 7/8] fix: update point and mesh picking methods to use 'use_picker' instead of 'use_mesh' to avoid warning --- src/ansys/mapdl/core/mapdl_core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/mapdl/core/mapdl_core.py b/src/ansys/mapdl/core/mapdl_core.py index 8ed8444d63d..e731977c0f5 100644 --- a/src/ansys/mapdl/core/mapdl_core.py +++ b/src/ansys/mapdl/core/mapdl_core.py @@ -2758,7 +2758,7 @@ def get_entnum(mesh): # Picking points pl.scene.enable_point_picking( callback=callback_points, - use_mesh=True, + use_picker=True, show_message=gen_text(), show_point=True, left_clicking=PICKING_USING_LEFT_CLICKING, @@ -2769,7 +2769,7 @@ def get_entnum(mesh): # Picking meshes pl.scene.enable_mesh_picking( callback=callback_mesh, - use_mesh=True, + use_picker=True, show=False, # This should be false to avoid a warning. show_message=gen_text(), left_clicking=PICKING_USING_LEFT_CLICKING, From e47d352cb8b7ecd6c183c52cdf8b50b85cca4210 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Tue, 20 May 2025 13:17:26 +0200 Subject: [PATCH 8/8] fix: undo changes --- src/ansys/mapdl/core/mapdl_core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/mapdl/core/mapdl_core.py b/src/ansys/mapdl/core/mapdl_core.py index e731977c0f5..8ed8444d63d 100644 --- a/src/ansys/mapdl/core/mapdl_core.py +++ b/src/ansys/mapdl/core/mapdl_core.py @@ -2758,7 +2758,7 @@ def get_entnum(mesh): # Picking points pl.scene.enable_point_picking( callback=callback_points, - use_picker=True, + use_mesh=True, show_message=gen_text(), show_point=True, left_clicking=PICKING_USING_LEFT_CLICKING, @@ -2769,7 +2769,7 @@ def get_entnum(mesh): # Picking meshes pl.scene.enable_mesh_picking( callback=callback_mesh, - use_picker=True, + use_mesh=True, show=False, # This should be false to avoid a warning. show_message=gen_text(), left_clicking=PICKING_USING_LEFT_CLICKING,