Skip to content

Commit

Permalink
Merge branch 'main' into release/0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcapodi78 authored and maxcapodi78 committed Mar 22, 2023
2 parents a10c997 + 646bf17 commit ea09d37
Show file tree
Hide file tree
Showing 101 changed files with 11,371 additions and 528 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/cpython_linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
name: Linux_CPython_UnitTests

env:
python.version: '3.10'
python.venv: 'testvenv'
# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
# You should go up in number, if you go down (or repeat a previous value)
# you might end up reusing a previous cache if it haven't been deleted already.
# It applies 7 days retention policy by default.
RESET_PIP_CACHE: 0
PACKAGE_NAME: PyAEDT


on:
workflow_dispatch:
inputs:
Expand All @@ -19,28 +31,37 @@ concurrency:
jobs:
test:
runs-on: [Linux, pyaedt]
strategy:
matrix:
python-version: [ '3.10' ]
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: 'Install pyaedt'
run: |
python -m venv .pyaedt_test_env
export ANSYSEM_ROOT222=/apps/AnsysEM/v222/Linux64
export LD_LIBRARY_PATH=$ANSYSEM_ROOT222/common/mono/Linux64/lib64:$ANSYSEM_ROOT222/Delcross:$LD_LIBRARY_PATH
source .pyaedt_test_env/bin/activate
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U
python -c "import sys; print(sys.executable)"
pip install .
pip install -r requirements/requirements_test.txt
pip install pytest-azurepipelines
cp "C:\actions-runner\opengl32.dll" "testenv\Lib\site-packages\vtkmodules"
mkdir tmp
cd tmp
pip install .[tests]
pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pytest-azurepipelines
python -c "import pyaedt; print('Imported pyaedt')"
- name: 'Unit testing'
timeout-minutes: 30
run: |
testenv\Scripts\Activate.ps1
pytest -n 4 --dist loadfile -v --cov=pyaedt --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest -p no:faulthandler
export ANSYSEM_ROOT222=/apps/AnsysEM/v222/Linux64
export LD_LIBRARY_PATH=$ANSYSEM_ROOT222/common/mono/Linux64/lib64:$ANSYSEM_ROOT222/Delcross:$LD_LIBRARY_PATH
source .pyaedt_test_env/bin/activate
pytest -n 4 --durations=50 --dist loadfile -v _unittest
- name: Upload pytest test results
uses: actions/upload-artifact@v3
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/unit_test_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ jobs:
- name: 'Install pyaedt'
run: |
testenv\Scripts\Activate.ps1
pip install .
pip install -r requirements/requirements_test.txt
pip install .[tests]
pip install pytest-azurepipelines
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "testenv\Lib\site-packages\vtkmodules" -Force
Copy-Item -Path "C:\actions-runner\local_config.json" -Destination "_unittest" -Force
Expand All @@ -68,11 +67,11 @@ jobs:
# uses: pyansys/pydpf-actions/[email protected]

- name: 'Unit testing'
timeout-minutes: 25
timeout-minutes: 30
run: |
testenv\Scripts\Activate.ps1
Set-Item -Path env:PYTHONMALLOC -Value "malloc"
pytest -n 6 --dist loadfile -v --cov=pyaedt --cov-report=xml --junitxml=junit/test-results.xml --cov-report=html _unittest
pytest -n 6 --durations=50 --dist loadfile -v --cov=pyaedt --cov-report=xml --junitxml=junit/test-results.xml --cov-report=html _unittest
- uses: codecov/codecov-action@v3
if: matrix.python-version == '3.8'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheelhouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
pip install .
pip install .[all]
pip install jupyterlab
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheelhouse_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- name: Install pyaedt
run: |
pip install .
pip install .[all]
- name: Verify pyaedt can be imported
run: python -c "import pyaedt"
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repos:
- --max-line-length=120

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.4
hooks:
- id: codespell
args: ["--ignore-words=ignore_words.txt"]
Expand All @@ -49,7 +49,7 @@ repos:

# validate GitHub workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
rev: 0.22.0
hooks:
- id: check-github-workflows

Expand Down
30 changes: 22 additions & 8 deletions _unittest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from pyaedt import Edb
from pyaedt import Hfss
from pyaedt.generic.filesystem import Scratch
from pyaedt.misc.misc import list_installed_ansysem

test_project_name = "test_primitives"

Expand All @@ -54,6 +55,9 @@

# Initialize default desktop configuration
default_version = "2023.1"
if "ANSYSEM_ROOT".format(default_version[2:].replace(".", "")) not in list_installed_ansysem():
default_version = list_installed_ansysem()[0][12:].replace(".", "")
default_version = "20{}.{}".format(default_version[:2], default_version[-1])
os.environ["ANSYSEM_FEATURE_SS544753_ICEPAK_VIRTUALMESHREGION_PARADIGM_ENABLE"] = "1"
if inside_desktop and "oDesktop" in dir(sys.modules["__main__"]):
default_version = sys.modules["__main__"].oDesktop.GetVersion()[0:6]
Expand Down Expand Up @@ -120,11 +124,12 @@ def my_teardown(self):
proj_list = []
if oDesktop and not settings.non_graphical:
oDesktop.ClearMessages("", "", 3)
for proj in proj_list:
try:
oDesktop.CloseProject(proj)
except:
pass
if proj_list:
for proj in proj_list:
try:
oDesktop.CloseProject(proj)
except:
pass
# self.aedtapps[0].release_desktop(False)

logger.remove_all_project_file_logger()
Expand Down Expand Up @@ -213,10 +218,19 @@ def desktop_init():
# # release_desktop(close_projects=False, close_desktop=True)
# except:
# pass
desktop = Desktop(desktop_version, settings.non_graphical, new_thread)
if os.name != "posix" or is_ironpython:
desktop = Desktop(desktop_version, settings.non_graphical, new_thread)
yield
desktop.release_desktop(True, True)
del desktop
if os.name != "posix" or is_ironpython:
desktop.release_desktop(True, True)
del desktop

else:
_main = sys.modules["__main__"]
try:
os.kill(_main.desktop_pid, 9)
except:
pass
gc.collect()
if config["test_desktops"]:
run_desktop_tests()
Expand Down
Binary file added _unittest/example_models/T17/freighter_rays.hdm
Binary file not shown.
Loading

0 comments on commit ea09d37

Please sign in to comment.