From 9bd866c37d07a2b8001934f6a270623046acfc20 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:43:12 +0100 Subject: [PATCH] ci: adding profiling to pytest --- .ci/collect_mapdl_logs_locals.sh | 4 ++++ .ci/collect_mapdl_logs_remote.sh | 3 +++ .github/workflows/ci.yml | 2 +- pyproject.toml | 1 + tests/conftest.py | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.ci/collect_mapdl_logs_locals.sh b/.ci/collect_mapdl_logs_locals.sh index 5b4eff1c4a..bc97f05555 100755 --- a/.ci/collect_mapdl_logs_locals.sh +++ b/.ci/collect_mapdl_logs_locals.sh @@ -1,10 +1,14 @@ mkdir "$LOG_NAMES" && echo "Successfully generated directory $LOG_NAMES" +echo "Copying the log files..." cp *.log ./"$LOG_NAMES"/ || echo "No log files could be found" cp *apdl.out ./"$LOG_NAMES"/ || echo "No APDL log files could be found" cp *pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be found" +echo "Copying the profiling files..." +cp prof ./"$LOG_NAMES"/prof || echo "No profile files could be found" + ls -la ./"$LOG_NAMES" diff --git a/.ci/collect_mapdl_logs_remote.sh b/.ci/collect_mapdl_logs_remote.sh index 57ce2bedaf..3647de6309 100755 --- a/.ci/collect_mapdl_logs_remote.sh +++ b/.ci/collect_mapdl_logs_remote.sh @@ -35,6 +35,9 @@ echo "Copying docker launch log..." cp mapdl_launch_0.log ./"$LOG_NAMES"/mapdl_launch_0.log || echo "MAPDL launch docker log not found." cp mapdl_launch_1.log ./"$LOG_NAMES"/mapdl_launch_1.log || echo "MAPDL launch docker log not found." +echo "Copying the profiling files..." +cp prof ./"$LOG_NAMES"/prof || echo "No profile files could be found" + echo "Collecting file structure..." ls -R > ./"$LOG_NAMES"/files_structure.txt || echo "Failed to copy file structure to a file" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2addda71af..1648fc1ca8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ env: DPF_PORT: 21004 MAPDL_PACKAGE: ghcr.io/ansys/mapdl ON_CI: True - PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=10 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180' + 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' BUILD_CHEATSHEET: True diff --git a/pyproject.toml b/pyproject.toml index d486c5bac2..6d652c496b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ tests = [ "pyfakefs==5.7.3", "pyiges[full]==0.3.1", "pytest-cov==6.0.0", + "pytest-profiling==1.8.1", "pytest-pyvista==0.1.9", "pytest-random-order==1.1.1", "pytest-rerunfailures==15.0", diff --git a/tests/conftest.py b/tests/conftest.py index b703f06470..48502c4eeb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -57,6 +57,7 @@ # Setting testing environment # --------------------------- # +pytest_plugins = ["pytest_profiling"] DEBUG_TESTING = debug_testing() TESTING_MINIMAL = testing_minimal()