diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index a73314b6..c2a748b0 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -99,17 +99,29 @@ jobs: env: ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} - - name: Test AEDT common + - name: Test Common API + timeout-minutes: 2 + run: | + .\.venv\Scripts\Activate.ps1 + pytest -v -m tests_common_api --cov + + - name: Test AEDT API + timeout-minutes: 5 + run: | + .\.venv\Scripts\Activate.ps1 + pytest -v -m tests_aedt_api --cov --cov-append + + - name: Test EDB API timeout-minutes: 5 run: | .\.venv\Scripts\Activate.ps1 - pytest -v -m common --cov + pytest -v -m tests_edb_api --cov --cov-append -# - name: AEDT Test -# timeout-minutes: 5 -# run: | -# .\.venv\Scripts\Activate.ps1 -# pytest -v -m aedt --cov --cov-append + - name: Test REST API + timeout-minutes: 5 + run: | + .\.venv\Scripts\Activate.ps1 + pytest -v -m tests_rest_api --cov --cov-append - name: "Combine coverage files" run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37422146..7fd10e3d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: | (?x)( src/ansys/aedt/toolkits/common/ui/utils/ui_templates/.* | - tests/input_data/.* | + tests/.* | examples/.* | README.rst ) @@ -9,7 +9,7 @@ exclude: | repos: - repo: https://github.com/psf/black - rev: 23.11.0 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!! + rev: 24.1.1 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!! hooks: - id: black args: @@ -19,17 +19,17 @@ repos: rev: 1.16.0 hooks: - id: blacken-docs - additional_dependencies: [black==23.11.0] + additional_dependencies: [black==24.1.1] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort name: isort (python) args: ['--force-single-line-imports', '--profile', 'black'] - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 args: diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..0fe89500 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,12 @@ +# This is the list of PyAEDT significant contributors. +# +# This file does not necessarily list everyone who has contributed code. +# +# For contributions made under a Corporate CLA, the organization is +# added to this file. +# +# If you have contributed to the repository and want to be added to this file, +# submit a request. +# +# +ANSYS, Inc. \ No newline at end of file diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 00000000..7f96dc7f --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,11 @@ +# Contributors + +## Project Lead + +* [Samuel Lopez](https://github.com/Samuelopez-ansys) + +## Individual Contributors + +* [Giulia Malinverno](https://github.com/gmalinve) +* [Sébastien Morais](https://github.com/SMoraisAnsys) +* [Kathy Pippert](https://github.com/PipKat) \ No newline at end of file diff --git a/doc/.vale.ini b/doc/.vale.ini index 4f0b6709..de42720f 100644 --- a/doc/.vale.ini +++ b/doc/.vale.ini @@ -26,3 +26,10 @@ Vocab = ANSYS # Apply the following styles BasedOnStyles = Vale, Google + + +# Removing Google-specific rule - Not applicable under some circumstances +Google.Colons = NO + +# Ignore content within inline roles +TokenIgnores = (:.*:`.*`)|(<.*>) diff --git a/doc/source/conf.py b/doc/source/conf.py index d39d04ef..6da6c3c0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """Sphinx documentation configuration file.""" from datetime import datetime import os diff --git a/doc/styles/Vocab/ANSYS/accept.txt b/doc/styles/Vocab/ANSYS/accept.txt index b5e5b46a..dc117fd9 100644 --- a/doc/styles/Vocab/ANSYS/accept.txt +++ b/doc/styles/Vocab/ANSYS/accept.txt @@ -16,5 +16,3 @@ Rest_api.py Properties.json Api.py EDBCommon - - diff --git a/examples/toolkit/pyaedt_toolkit/__init__.py b/examples/toolkit/pyaedt_toolkit/__init__.py index 440f06ea..c53a4363 100644 --- a/examples/toolkit/pyaedt_toolkit/__init__.py +++ b/examples/toolkit/pyaedt_toolkit/__init__.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ pyaedt-toolkits. """ diff --git a/examples/toolkit/pyaedt_toolkit/backend/__init__.py b/examples/toolkit/pyaedt_toolkit/backend/__init__.py index e69de29b..3bc3c8e5 100644 --- a/examples/toolkit/pyaedt_toolkit/backend/__init__.py +++ b/examples/toolkit/pyaedt_toolkit/backend/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/pytest.ini b/pytest.ini index c45dc381..c42a2838 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,6 @@ [pytest] -addopts = -v - markers = - common: mark tests related to the common api \ No newline at end of file + tests_common_api: mark tests related to the common api + tests_aedt_api: mark tests related to the aedt api + tests_edb_api: mark tests related to the edb api + tests_rest_api: mark tests related to the rest api diff --git a/src/ansys/aedt/toolkits/common/__init__.py b/src/ansys/aedt/toolkits/common/__init__.py index 025b2aea..7d1053fd 100644 --- a/src/ansys/aedt/toolkits/common/__init__.py +++ b/src/ansys/aedt/toolkits/common/__init__.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ pyaedt-toolkits. diff --git a/src/ansys/aedt/toolkits/common/backend/__init__.py b/src/ansys/aedt/toolkits/common/backend/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/backend/__init__.py +++ b/src/ansys/aedt/toolkits/common/backend/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/backend/api.py b/src/ansys/aedt/toolkits/common/backend/api.py index 7ccd3dcc..93c49fa8 100644 --- a/src/ansys/aedt/toolkits/common/backend/api.py +++ b/src/ansys/aedt/toolkits/common/backend/api.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from dataclasses import dataclass from enum import Enum import os diff --git a/src/ansys/aedt/toolkits/common/backend/constants.py b/src/ansys/aedt/toolkits/common/backend/constants.py index cf112082..46a842e5 100644 --- a/src/ansys/aedt/toolkits/common/backend/constants.py +++ b/src/ansys/aedt/toolkits/common/backend/constants.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ Toolkit common constants """ diff --git a/src/ansys/aedt/toolkits/common/backend/logger_handler.py b/src/ansys/aedt/toolkits/common/backend/logger_handler.py index 39fb353e..823589e1 100644 --- a/src/ansys/aedt/toolkits/common/backend/logger_handler.py +++ b/src/ansys/aedt/toolkits/common/backend/logger_handler.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import logging import os.path import tempfile diff --git a/src/ansys/aedt/toolkits/common/backend/models.py b/src/ansys/aedt/toolkits/common/backend/models.py index 2e5a8e8d..f113078a 100644 --- a/src/ansys/aedt/toolkits/common/backend/models.py +++ b/src/ansys/aedt/toolkits/common/backend/models.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import json import os from typing import Dict diff --git a/src/ansys/aedt/toolkits/common/backend/multithreading_server.py b/src/ansys/aedt/toolkits/common/backend/multithreading_server.py index bd445b6a..fffb6eb4 100644 --- a/src/ansys/aedt/toolkits/common/backend/multithreading_server.py +++ b/src/ansys/aedt/toolkits/common/backend/multithreading_server.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # -*- coding: utf-8 -*- import queue import socket diff --git a/src/ansys/aedt/toolkits/common/backend/rest_api.py b/src/ansys/aedt/toolkits/common/backend/rest_api.py index 5a42b370..e2ea5840 100644 --- a/src/ansys/aedt/toolkits/common/backend/rest_api.py +++ b/src/ansys/aedt/toolkits/common/backend/rest_api.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import json from flask import Flask diff --git a/src/ansys/aedt/toolkits/common/backend/thread_manager.py b/src/ansys/aedt/toolkits/common/backend/thread_manager.py index 5a543367..053f6423 100644 --- a/src/ansys/aedt/toolkits/common/backend/thread_manager.py +++ b/src/ansys/aedt/toolkits/common/backend/thread_manager.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import threading import time from typing import List diff --git a/src/ansys/aedt/toolkits/common/ui/__init__.py b/src/ansys/aedt/toolkits/common/ui/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/actions_generic.py b/src/ansys/aedt/toolkits/common/ui/actions_generic.py index ff0a4307..a04bc802 100644 --- a/src/ansys/aedt/toolkits/common/ui/actions_generic.py +++ b/src/ansys/aedt/toolkits/common/ui/actions_generic.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import time diff --git a/src/ansys/aedt/toolkits/common/ui/common_windows/home_menu.py b/src/ansys/aedt/toolkits/common/ui/common_windows/home_menu.py index 178851cd..69af91f9 100644 --- a/src/ansys/aedt/toolkits/common/ui/common_windows/home_menu.py +++ b/src/ansys/aedt/toolkits/common/ui/common_windows/home_menu.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from PySide6.QtWidgets import QSizePolicy from PySide6.QtWidgets import QSpacerItem diff --git a/src/ansys/aedt/toolkits/common/ui/common_windows/main_window.py b/src/ansys/aedt/toolkits/common/ui/common_windows/main_window.py index 6e207b95..52e5cca7 100644 --- a/src/ansys/aedt/toolkits/common/ui/common_windows/main_window.py +++ b/src/ansys/aedt/toolkits/common/ui/common_windows/main_window.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from PySide6.QtCore import Qt from PySide6.QtSvgWidgets import QSvgWidget from PySide6.QtWidgets import QLabel diff --git a/src/ansys/aedt/toolkits/common/ui/common_windows/settings_column.py b/src/ansys/aedt/toolkits/common/ui/common_windows/settings_column.py index 709cc9d3..fe52b2fe 100644 --- a/src/ansys/aedt/toolkits/common/ui/common_windows/settings_column.py +++ b/src/ansys/aedt/toolkits/common/ui/common_windows/settings_column.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os from PySide6.QtCore import QObject diff --git a/src/ansys/aedt/toolkits/common/ui/logger_handler.py b/src/ansys/aedt/toolkits/common/ui/logger_handler.py index 95bd3d0e..a668286c 100644 --- a/src/ansys/aedt/toolkits/common/ui/logger_handler.py +++ b/src/ansys/aedt/toolkits/common/ui/logger_handler.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import logging import os import tempfile diff --git a/src/ansys/aedt/toolkits/common/ui/main_window/main_window_layout.py b/src/ansys/aedt/toolkits/common/ui/main_window/main_window_layout.py index 83defc32..2a8afe5d 100644 --- a/src/ansys/aedt/toolkits/common/ui/main_window/main_window_layout.py +++ b/src/ansys/aedt/toolkits/common/ui/main_window/main_window_layout.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from PySide6 import QtCore from PySide6 import QtGui from PySide6.QtWidgets import QFrame diff --git a/src/ansys/aedt/toolkits/common/ui/models.py b/src/ansys/aedt/toolkits/common/ui/models.py index b5f5316f..e1303953 100644 --- a/src/ansys/aedt/toolkits/common/ui/models.py +++ b/src/ansys/aedt/toolkits/common/ui/models.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import json import os from typing import Any diff --git a/src/ansys/aedt/toolkits/common/ui/utils/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/images/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/images/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/images/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/images/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/images/load_images.py b/src/ansys/aedt/toolkits/common/ui/utils/images/load_images.py index d2fde692..b8800020 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/images/load_images.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/images/load_images.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os import pathlib diff --git a/src/ansys/aedt/toolkits/common/ui/utils/themes/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/themes/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/themes/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/themes/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/columns/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/columns/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/columns/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/columns/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/pages/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/pages/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/pages/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/ui_templates/pages/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/__init__.py index 544ef768..41bebfd6 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/__init__.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ansys.aedt.toolkits.common.ui.utils.widgets.py_combo_box.py_combo_box import PyComboBox from ansys.aedt.toolkits.common.ui.utils.widgets.py_credits.py_credits import PyCredits from ansys.aedt.toolkits.common.ui.utils.widgets.py_div.py_div import PyDiv diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_combo_box/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_combo_box/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_combo_box/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_combo_box/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_credits/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_credits/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_credits/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_credits/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_div/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_div/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_div/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_div/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_icon/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_icon/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_icon/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_icon/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_icon_button/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_icon_button/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_icon_button/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_icon_button/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_label/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_label/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_label/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_label/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_left_column/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_left_column/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_left_column/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_left_column/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_left_menu/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_left_menu/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_left_menu/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_left_menu/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_line_edit/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_line_edit/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_line_edit/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_line_edit/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_logger/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_logger/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_logger/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_logger/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_progress/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_progress/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_progress/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_progress/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_push_button/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_push_button/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_push_button/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_push_button/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_right_column/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_right_column/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_right_column/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_right_column/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_slider/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_slider/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_slider/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_slider/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_title_bar/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_title_bar/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_title_bar/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_title_bar/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_toggle/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_toggle/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_toggle/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_toggle/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_window/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_window/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_window/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/widgets/py_window/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/windows/__init__.py b/src/ansys/aedt/toolkits/common/ui/utils/windows/__init__.py index e69de29b..3bc3c8e5 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/windows/__init__.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/windows/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/src/ansys/aedt/toolkits/common/ui/utils/windows/common_window_utils.py b/src/ansys/aedt/toolkits/common/ui/utils/windows/common_window_utils.py index 319b5f17..034b6287 100644 --- a/src/ansys/aedt/toolkits/common/ui/utils/windows/common_window_utils.py +++ b/src/ansys/aedt/toolkits/common/ui/utils/windows/common_window_utils.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from PySide6.QtCore import QEasingCurve from PySide6.QtCore import QParallelAnimationGroup from PySide6.QtCore import QPropertyAnimation diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..3bc3c8e5 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/tests/backend/__init__.py b/tests/backend/__init__.py index e69de29b..3bc3c8e5 100644 --- a/tests/backend/__init__.py +++ b/tests/backend/__init__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/tests/backend/tests_aedt_api/__init__.py b/tests/backend/tests_aedt_api/__init__.py index 51dee7ba..1acefe36 100644 --- a/tests/backend/tests_aedt_api/__init__.py +++ b/tests/backend/tests_aedt_api/__init__.py @@ -1,2 +1,24 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """Test API """ diff --git a/tests/backend/tests_aedt_api/backend_properties.json b/tests/backend/tests_aedt_api/backend_properties.json index 30e83719..8f98513d 100644 --- a/tests/backend/tests_aedt_api/backend_properties.json +++ b/tests/backend/tests_aedt_api/backend_properties.json @@ -1,5 +1,5 @@ { - "debug" : true, + "debug" : false, "log_file" : "test_aedt_api.log", "desktop_version": "2023.2", "non_graphical": true, diff --git a/tests/backend/tests_aedt_api/conftest.py b/tests/backend/tests_aedt_api/conftest.py index 0bb8afc6..0a9c2ce8 100644 --- a/tests/backend/tests_aedt_api/conftest.py +++ b/tests/backend/tests_aedt_api/conftest.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ API Test Configuration Module ----------------------------- @@ -20,16 +42,15 @@ import json import logging -import os import pathlib import shutil -import tempfile from pyaedt import settings -from pyaedt.generic.filesystem import Scratch import pytest +# Load properties from backend_properties.json from tests.backend.tests_aedt_api.models import properties +from tests.conftest import common_temp_dir config = { "desktop_version": properties.aedt_version, @@ -38,112 +59,80 @@ } # Check for the local config file, override defaults if found -local_path = os.path.dirname(os.path.realpath(__file__)) -local_config_file = os.path.join(local_path, "local_config.json") -if os.path.exists(local_config_file): +local_path = pathlib.Path(__file__).resolve().parent +local_config_file = pathlib.Path(local_path, "local_config.json") +if local_config_file.exists(): with open(local_config_file) as f: local_config = json.load(f) config.update(local_config) -properties.use_grpc = config.get("use_grpc", True) +properties.use_grpc = config["use_grpc"] properties.non_graphical = config["non_graphical"] properties.aedt_version = config["desktop_version"] -com_non_graphical = False -if not properties.use_grpc and properties.non_graphical: - com_non_graphical = True - settings.enable_error_handler = False settings.enable_desktop_logs = False -settings.use_grpc_api = config.get("use_grpc", True) +settings.use_grpc_api = config["use_grpc"] settings.non_graphical = config["non_graphical"] -scratch_path = tempfile.gettempdir() -local_scratch = Scratch(scratch_path) +failed_tests = set() + -input_data_dir = pathlib.Path(__file__).parent.parent.parent -aedt_project = os.path.join(input_data_dir, "input_data", "Test.aedt") -aedt_scratch = shutil.copy(aedt_project, local_scratch.path) +def create_logger(temp_dir, name): + logger = logging.getLogger(__name__) + logger.setLevel(logging.DEBUG) + log_file = pathlib.Path(temp_dir, name) + file_handler = logging.FileHandler(log_file) + formatter = logging.Formatter("%(levelname)s - %(message)s") + file_handler.setFormatter(formatter) + logger.addHandler(file_handler) + logging.StreamHandler() + formatter = logging.Formatter("%(levelname)s - %(message)s") + console_handler = logging.StreamHandler() + console_handler.setFormatter(formatter) + logger.addHandler(console_handler) + return logger -logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) -log_file = os.path.join(local_scratch.path, "pytest_api.log") -file_handler = logging.FileHandler(log_file) -formatter = logging.Formatter("%(levelname)s - %(message)s") -file_handler.setFormatter(formatter) -logger.addHandler(file_handler) -logging.StreamHandler() -formatter = logging.Formatter("%(levelname)s - %(message)s") -console_handler = logging.StreamHandler() -console_handler.setFormatter(formatter) -logger.addHandler(console_handler) +def release_logger(logger): + for handler in logger.handlers[:]: + handler.close() + logger.removeHandler(handler) @pytest.fixture(scope="session") -def aedt_common(request): +def aedt_common(common_temp_dir): from ansys.aedt.toolkits.common.backend.api import AEDTCommon + logger = create_logger(common_temp_dir, "pytest_aedt_api.log") + logger.info("AEDTCommon API initialization") aedt_common = AEDTCommon(properties) - if com_non_graphical: - logger.error("COM in non graphical not allowed") - yield aedt_common - else: - aedt_common.launch_thread(aedt_common.launch_aedt) - is_aedt_launched = aedt_common.wait_to_be_idle() - if is_aedt_launched: - aedt_common.open_project(aedt_scratch) + aedt_common.launch_thread(aedt_common.launch_aedt) + is_aedt_launched = aedt_common.wait_to_be_idle() + aedt_project = pathlib.Path(common_temp_dir, "input_data", "Test.aedt") + if is_aedt_launched: + project_flag = aedt_common.open_project(str(aedt_project)) + if project_flag: yield aedt_common - aedt_common.release_aedt(True, True) else: - logger.error("AEDT is not launched") + logger.error("Open project failed") + aedt_common.release_aedt(True, True) + logger.info("AEDT released") + else: + logger.error("AEDT is not launched") - aedt_common.release_aedt(True, True) # Check if any test has failed - if request.session.testsfailed == 0: - cleanup_process() - - -failed_tests = set() + if not failed_tests: + logger.info(f"All tests passed successfully") + release_logger(logger) + shutil.rmtree(pathlib.Path(common_temp_dir.parent), ignore_errors=True) + else: + for failed_test in failed_tests: + logger.error(f"FAILED: {failed_test.name}") + release_logger(logger) def pytest_runtest_makereport(item, call): if call.excinfo is not None and call.excinfo.typename == "AssertionError": failed_tests.add(item) - - -@pytest.fixture(scope="session") -def assert_handler(request): - def finalizer(): - # Code to run after the test - logger.info("Test Teardown") - # Check if any test has failed during the session - if request.session.testsfailed != 0: - # Additional code to run when an assert fails - for failed_test in failed_tests: - logger.error(f"FAILED: {failed_test.name}") - - request.addfinalizer(finalizer) - - return assert_handler - - -@pytest.fixture(scope="session") -def aedt_example(): - return aedt_scratch - - -def skip_test(skip=False): - skip_flag = False - if com_non_graphical or skip: - skip_flag = True - return skip_flag - - -def cleanup_process(): - """Cleanup process after the test is completed.""" - for handler in logger.handlers: - if isinstance(handler, logging.FileHandler): - handler.close() - shutil.rmtree(local_scratch.path, ignore_errors=True) diff --git a/tests/backend/tests_aedt_api/models.py b/tests/backend/tests_aedt_api/models.py index 648fbbeb..e160030f 100644 --- a/tests/backend/tests_aedt_api/models.py +++ b/tests/backend/tests_aedt_api/models.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import json import os @@ -10,8 +32,6 @@ class BackendProperties(BaseModel): """Store toolkit properties.""" - new_property: bool = True - class Properties(BackendProperties, CommonProperties, validate_assignment=True): """Store all properties.""" diff --git a/tests/backend/tests_aedt_api/test_aedt.py b/tests/backend/tests_aedt_api/test_aedt.py index c1c044d8..13d2e98f 100644 --- a/tests/backend/tests_aedt_api/test_aedt.py +++ b/tests/backend/tests_aedt_api/test_aedt.py @@ -1,29 +1,43 @@ -import os +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +import os import pytest -from tests.backend.tests_aedt_api.conftest import skip_test - +@pytest.mark.tests_aedt_api class TestAEDT: """AEDTCommon unit tests.""" - def test_00_connect_aedt(self, aedt_common, assert_handler): + def test_00_connect_aedt(self, aedt_common): """Connect AEDT.""" - if skip_test(): - pytest.skip() - assert aedt_common.connect_aedt() assert aedt_common.connect_aedt() assert aedt_common.release_aedt() - def test_01_connect_design(self, aedt_common, assert_handler): + def test_01_connect_design(self, aedt_common): """Connect design.""" - if skip_test(): - pytest.skip() - assert aedt_common.connect_design() assert aedt_common.connect_design() aedt_common.properties.active_design = "No Design" @@ -31,31 +45,24 @@ def test_01_connect_design(self, aedt_common, assert_handler): aedt_common.properties.active_design = "No Design" assert aedt_common.connect_design("Tesla") - def test_02_open_project(self, aedt_common, assert_handler, aedt_example): + def test_02_open_project(self, aedt_common, common_temp_dir): """Open AEDT project.""" - if skip_test(): - pytest.skip() - - assert not aedt_common.open_project(aedt_example) + opened_project = os.path.join(common_temp_dir, "input_data", "Test.aedt") + assert not aedt_common.open_project(opened_project) - def test_03_save_project(self, aedt_common, assert_handler, aedt_example): + def test_03_save_project(self, aedt_common, common_temp_dir): """Save AEDT project.""" - if skip_test(): - pytest.skip() - assert aedt_common.save_project() - new_project = os.path.join(os.path.dirname(aedt_example), "New.aedt") + new_project = os.path.join(common_temp_dir, "input_data", "New.aedt") assert aedt_common.save_project(new_project) - def test_04_get_design_names(self, aedt_common, assert_handler): + def test_04_get_design_names(self, aedt_common): """Get design names.""" - if skip_test(): - pytest.skip() - design_names = aedt_common.get_design_names() + number_designs = len(design_names) assert isinstance(design_names, list) aedt_common.properties.active_project = aedt_common.properties.project_list[0] active_project_name = aedt_common.get_project_name(aedt_common.properties.active_project) diff --git a/tests/backend/tests_common_api/__init__.py b/tests/backend/tests_common_api/__init__.py index 51dee7ba..1acefe36 100644 --- a/tests/backend/tests_common_api/__init__.py +++ b/tests/backend/tests_common_api/__init__.py @@ -1,2 +1,24 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """Test API """ diff --git a/tests/backend/tests_common_api/backend_properties.json b/tests/backend/tests_common_api/backend_properties.json index bb1af541..f50354e2 100644 --- a/tests/backend/tests_common_api/backend_properties.json +++ b/tests/backend/tests_common_api/backend_properties.json @@ -1,5 +1,5 @@ { - "debug" : true, + "debug" : false, "log_file" : "test_common_api.log", "desktop_version": "2023.2", "non_graphical": true, diff --git a/tests/backend/tests_common_api/conftest.py b/tests/backend/tests_common_api/conftest.py index 8ff2c1d5..4d42974c 100644 --- a/tests/backend/tests_common_api/conftest.py +++ b/tests/backend/tests_common_api/conftest.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ API Test Configuration Module ----------------------------- @@ -19,79 +41,61 @@ """ import logging -import os +import pathlib import shutil -import tempfile -from pyaedt.generic.filesystem import Scratch +from pyaedt import settings import pytest +# Load properties from backend_properties.json from tests.backend.tests_common_api.models import properties +from tests.conftest import common_temp_dir + +failed_tests = set() -scratch_path = tempfile.gettempdir() -local_scratch = Scratch(scratch_path) -logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) -log_file = os.path.join(local_scratch.path, "pytest_api.log") -file_handler = logging.FileHandler(log_file) -formatter = logging.Formatter("%(levelname)s - %(message)s") -file_handler.setFormatter(formatter) -logger.addHandler(file_handler) +def create_logger(temp_dir, name): + logger = logging.getLogger(__name__) + logger.setLevel(logging.DEBUG) + log_file = pathlib.Path(temp_dir, name) + file_handler = logging.FileHandler(log_file) + formatter = logging.Formatter("%(levelname)s - %(message)s") + file_handler.setFormatter(formatter) + logger.addHandler(file_handler) + logging.StreamHandler() + formatter = logging.Formatter("%(levelname)s - %(message)s") + console_handler = logging.StreamHandler() + console_handler.setFormatter(formatter) + logger.addHandler(console_handler) + return logger -logging.StreamHandler() -formatter = logging.Formatter("%(levelname)s - %(message)s") -console_handler = logging.StreamHandler() -console_handler.setFormatter(formatter) -logger.addHandler(console_handler) + +def release_logger(logger): + for handler in logger.handlers[:]: + handler.close() + logger.removeHandler(handler) @pytest.fixture(scope="session") -def common(request): +def common(common_temp_dir): from ansys.aedt.toolkits.common.backend.api import Common + logger = create_logger(common_temp_dir, "pytest_common_api.log") + logger.info("Common API initialization") common_api = Common(properties) yield common_api # Check if any test has failed - if request.session.testsfailed == 0: - cleanup_process() - - -failed_tests = set() + if not failed_tests: + logger.info(f"All tests passed successfully") + release_logger(logger) + shutil.rmtree(pathlib.Path(common_temp_dir.parent), ignore_errors=True) + else: + for failed_test in failed_tests: + logger.error(f"FAILED: {failed_test.name}") + release_logger(logger) def pytest_runtest_makereport(item, call): if call.excinfo is not None and call.excinfo.typename == "AssertionError": failed_tests.add(item) - - -@pytest.fixture(scope="session") -def assert_handler(request): - def finalizer(): - # Code to run after the test - logger.info("Test Teardown") - # Check if any test has failed during the session - if request.session.testsfailed != 0: - # Additional code to run when an assert fails - for failed_test in failed_tests: - logger.error(f"FAILED: {failed_test.name}") - - request.addfinalizer(finalizer) - - return assert_handler - - -def skip_test(skip=False): - skip_flag = False - if com_non_graphical or skip: - skip_flag = True - return skip_flag - - -def cleanup_process(): - """Cleanup process after the test is completed.""" - for handler in logger.handlers: - if isinstance(handler, logging.FileHandler): - handler.close() - shutil.rmtree(local_scratch.path, ignore_errors=True) diff --git a/tests/backend/tests_common_api/models.py b/tests/backend/tests_common_api/models.py index 648fbbeb..6849067c 100644 --- a/tests/backend/tests_common_api/models.py +++ b/tests/backend/tests_common_api/models.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import json import os diff --git a/tests/backend/tests_common_api/test_common.py b/tests/backend/tests_common_api/test_common.py index 3a08319c..0ae2c544 100644 --- a/tests/backend/tests_common_api/test_common.py +++ b/tests/backend/tests_common_api/test_common.py @@ -1,18 +1,40 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import pytest -@pytest.mark.common +@pytest.mark.tests_common_api class TestCommon: """Common unit tests.""" - def test_00_get_properties(self, common, assert_handler): + def test_00_get_properties(self, common): """Get properties.""" api_properties = common.get_properties() assert api_properties assert common.properties.new_property == api_properties["new_property"] - def test_01_set_properties(self, common, assert_handler): + def test_01_set_properties(self, common): """Set properties.""" new_properties = {} @@ -44,7 +66,7 @@ def test_01_set_properties(self, common, assert_handler): is_updated, _ = common.set_properties(new_properties) assert not is_updated - def test_02_installed_aedt_version(self, common, assert_handler): + def test_02_installed_aedt_version(self, common): """Installed AEDT version.""" installed_versions = common.installed_aedt_version() assert isinstance(installed_versions, list) diff --git a/tests/backend/tests_edb_api/__init__.py b/tests/backend/tests_edb_api/__init__.py index 51dee7ba..1acefe36 100644 --- a/tests/backend/tests_edb_api/__init__.py +++ b/tests/backend/tests_edb_api/__init__.py @@ -1,2 +1,24 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """Test API """ diff --git a/tests/backend/tests_edb_api/backend_properties.json b/tests/backend/tests_edb_api/backend_properties.json index 2264fb90..d5d42a93 100644 --- a/tests/backend/tests_edb_api/backend_properties.json +++ b/tests/backend/tests_edb_api/backend_properties.json @@ -1,5 +1,5 @@ { - "debug" : true, + "debug" : false, "log_file" : "test_edb_api.log", "desktop_version": "2023.2" } \ No newline at end of file diff --git a/tests/backend/tests_edb_api/conftest.py b/tests/backend/tests_edb_api/conftest.py index 5bc36087..3c6c6147 100644 --- a/tests/backend/tests_edb_api/conftest.py +++ b/tests/backend/tests_edb_api/conftest.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ API Test Configuration Module ----------------------------- @@ -9,7 +31,9 @@ The default configuration can be changed by placing a file called local_config.json in the same directory as this module. An example of the contents of local_config.json { - "desktop_version": "2023.2" + "desktop_version": "2023.2", + "non_graphical": false, + "use_grpc": true } You can enable the API log file in the backend_properties.json. @@ -18,23 +42,22 @@ import json import logging -import os import pathlib import shutil -import tempfile from pyaedt import settings -from pyaedt.generic.filesystem import Scratch import pytest +# Load properties from backend_properties.json from tests.backend.tests_edb_api.models import properties +from tests.conftest import common_temp_dir config = {"desktop_version": properties.aedt_version} # Check for the local config file, override defaults if found -local_path = os.path.dirname(os.path.realpath(__file__)) -local_config_file = os.path.join(local_path, "local_config.json") -if os.path.exists(local_config_file): +local_path = pathlib.Path(__file__).resolve().parent +local_config_file = pathlib.Path(local_path, "local_config.json") +if local_config_file.exists(): with open(local_config_file) as f: local_config = json.load(f) config.update(local_config) @@ -44,83 +67,51 @@ settings.enable_error_handler = False settings.enable_desktop_logs = False -scratch_path = tempfile.gettempdir() -local_scratch = Scratch(scratch_path) +failed_tests = set() -input_data_dir = pathlib.Path(__file__).parent.parent.parent -aedt_project = os.path.join(input_data_dir, "input_data", "Test.aedt") -aedt_scratch = shutil.copy(aedt_project, local_scratch.path) -edb_scratch = shutil.copytree( - os.path.join(input_data_dir, "input_data", "edb_test.aedb"), os.path.join(local_scratch.path, "edb_test.aedb") -) +def create_logger(temp_dir, name): + logger = logging.getLogger(__name__) + logger.setLevel(logging.DEBUG) + log_file = pathlib.Path(temp_dir, name) + file_handler = logging.FileHandler(log_file) + formatter = logging.Formatter("%(levelname)s - %(message)s") + file_handler.setFormatter(formatter) + logger.addHandler(file_handler) + logging.StreamHandler() + formatter = logging.Formatter("%(levelname)s - %(message)s") + console_handler = logging.StreamHandler() + console_handler.setFormatter(formatter) + logger.addHandler(console_handler) + return logger -logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) -log_file = os.path.join(local_scratch.path, "pytest_api.log") -file_handler = logging.FileHandler(log_file) -formatter = logging.Formatter("%(levelname)s - %(message)s") -file_handler.setFormatter(formatter) -logger.addHandler(file_handler) -logging.StreamHandler() -formatter = logging.Formatter("%(levelname)s - %(message)s") -console_handler = logging.StreamHandler() -console_handler.setFormatter(formatter) -logger.addHandler(console_handler) +def release_logger(logger): + for handler in logger.handlers[:]: + handler.close() + logger.removeHandler(handler) @pytest.fixture(scope="session") -def edb_common(request): +def edb_common(common_temp_dir): from ansys.aedt.toolkits.common.backend.api import EDBCommon + logger = create_logger(common_temp_dir, "pytest_edb_api.log") + logger.info("EDBCommon API initialization") edb_common = EDBCommon(properties) yield edb_common # Check if any test has failed - if request.session.testsfailed == 0: - cleanup_process() - - -failed_tests = set() + if not failed_tests: + logger.info(f"All tests passed successfully") + release_logger(logger) + shutil.rmtree(pathlib.Path(common_temp_dir.parent), ignore_errors=True) + else: + for failed_test in failed_tests: + logger.error(f"FAILED: {failed_test.name}") + release_logger(logger) def pytest_runtest_makereport(item, call): if call.excinfo is not None and call.excinfo.typename == "AssertionError": failed_tests.add(item) - - -@pytest.fixture(scope="session") -def assert_handler(request): - def finalizer(): - # Code to run after the test - logger.info("Test Teardown") - # Check if any test has failed during the session - if request.session.testsfailed != 0: - # Additional code to run when an assert fails - for failed_test in failed_tests: - logger.error(f"FAILED: {failed_test.name}") - - request.addfinalizer(finalizer) - - return assert_handler - - -@pytest.fixture(scope="session") -def edb_example(): - return edb_scratch - - -def skip_test(skip=False): - skip_flag = False - if com_non_graphical or skip: - skip_flag = True - return skip_flag - - -def cleanup_process(): - """Cleanup process after the test is completed.""" - for handler in logger.handlers: - if isinstance(handler, logging.FileHandler): - handler.close() - shutil.rmtree(local_scratch.path, ignore_errors=True) diff --git a/tests/backend/tests_edb_api/models.py b/tests/backend/tests_edb_api/models.py index 648fbbeb..e160030f 100644 --- a/tests/backend/tests_edb_api/models.py +++ b/tests/backend/tests_edb_api/models.py @@ -1,3 +1,25 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import json import os @@ -10,8 +32,6 @@ class BackendProperties(BaseModel): """Store toolkit properties.""" - new_property: bool = True - class Properties(BackendProperties, CommonProperties, validate_assignment=True): """Store all properties.""" diff --git a/tests/backend/tests_edb_api/test_edb.py b/tests/backend/tests_edb_api/test_edb.py index 88a96f20..23464d7d 100644 --- a/tests/backend/tests_edb_api/test_edb.py +++ b/tests/backend/tests_edb_api/test_edb.py @@ -1,24 +1,46 @@ -import os.path +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +import os +import pytest +@pytest.mark.tests_edb_api class TestEDB: """EDBCommon unit tests.""" - def test_00_load_edb(self, edb_common, assert_handler, edb_example): - """Connect AEDT.""" - + def test_00_load_edb(self, edb_common, common_temp_dir): + """Load EDB.""" + edb_example = os.path.join(common_temp_dir, "input_data", "edb_test.aedb") assert not edb_common.load_edb(edb_example + "dummy") assert edb_common.load_edb(edb_example) assert not edb_common.load_edb(edb_example) - def test_01_save_edb(self, edb_common, assert_handler, edb_example): - """Connect AEDT.""" + def test_01_save_edb(self, edb_common, common_temp_dir): + """Save EDB.""" assert edb_common.save_edb() - directory, old_file_name = os.path.split(edb_example) - new_path = os.path.join(directory, "new_edb.aedb") + new_path = os.path.join(common_temp_dir, "input_data", "new_edb.aedb") assert edb_common.save_edb(new_path) - def test_02_close_edb(self, edb_common, assert_handler): - """Open AEDT project.""" + def test_02_close_edb(self, edb_common): + """Close EDB.""" assert edb_common.close_edb() assert not edb_common.close_edb() diff --git a/tests/backend/tests_rest_api/__init__.py b/tests/backend/tests_rest_api/__init__.py index bec76572..2c977017 100644 --- a/tests/backend/tests_rest_api/__init__.py +++ b/tests/backend/tests_rest_api/__init__.py @@ -1,2 +1,24 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """Test REST API """ diff --git a/tests/backend/tests_rest_api/backend_properties.json b/tests/backend/tests_rest_api/backend_properties.json new file mode 100644 index 00000000..889850fd --- /dev/null +++ b/tests/backend/tests_rest_api/backend_properties.json @@ -0,0 +1,7 @@ +{ + "debug" : false, + "log_file" : "test_rest_aedt_api.log", + "desktop_version": "2023.2", + "non_graphical": true, + "use_grpc": true +} \ No newline at end of file diff --git a/tests/backend/tests_rest_api/conftest.py b/tests/backend/tests_rest_api/conftest.py index 093a977f..a49f206d 100644 --- a/tests/backend/tests_rest_api/conftest.py +++ b/tests/backend/tests_rest_api/conftest.py @@ -1,10 +1,32 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + """ -REST API Test Configuration Module ----------------------------------- +API Test Configuration Module +----------------------------- Description =========== -This module contains the configuration and fixture for the pytest-based tests for the REST API. +This module contains the configuration and fixture for the pytest-based tests for the API. The default configuration can be changed by placing a file called local_config.json in the same directory as this module. An example of the contents of local_config.json @@ -20,116 +42,103 @@ import json import logging -import os import pathlib import shutil -import tempfile from pyaedt import settings -from pyaedt.generic.filesystem import Scratch import pytest -config = {"desktop_version": "2023.2", "non_graphical": True, "use_grpc": True, "debug": False} +# Load properties from backend_properties.json +from tests.backend.tests_rest_api.models import properties +from tests.conftest import common_temp_dir + +config = { + "desktop_version": properties.aedt_version, + "non_graphical": properties.non_graphical, + "use_grpc": properties.use_grpc, + "debug": False, +} # Check for the local config file, override defaults if found -local_path = os.path.dirname(os.path.realpath(__file__)) -local_config_file = os.path.join(local_path, "local_config.json") -if os.path.exists(local_config_file): +local_path = pathlib.Path(__file__).resolve().parent +local_config_file = pathlib.Path(local_path, "local_config.json") +if local_config_file.exists(): with open(local_config_file) as f: local_config = json.load(f) config.update(local_config) -# The import should be here to have the updated properties -from ansys.aedt.toolkits.common.backend.rest_api import app - settings.enable_error_handler = False settings.enable_desktop_logs = False -settings.use_grpc_api = config.get("use_grpc", True) +settings.use_grpc_api = config["use_grpc"] settings.non_graphical = config["non_graphical"] -scratch_path = tempfile.gettempdir() -local_scratch = Scratch(scratch_path) +failed_tests = set() + -input_data_dir = pathlib.Path(__file__).parent.parent.parent -aedt_project = os.path.join(input_data_dir, "input_data", "Test.aedt") -aedt_scratch = shutil.copy(aedt_project, local_scratch.path) +def create_logger(temp_dir, name): + logger = logging.getLogger(__name__) + logger.setLevel(logging.DEBUG) + log_file = pathlib.Path(temp_dir, name) + file_handler = logging.FileHandler(log_file) + formatter = logging.Formatter("%(levelname)s - %(message)s") + file_handler.setFormatter(formatter) + logger.addHandler(file_handler) + logging.StreamHandler() + formatter = logging.Formatter("%(levelname)s - %(message)s") + console_handler = logging.StreamHandler() + console_handler.setFormatter(formatter) + logger.addHandler(console_handler) + return logger -edb_scratch = shutil.copytree( - os.path.join(input_data_dir, "input_data", "edb_test.aedb"), os.path.join(local_scratch.path, "edb_test.aedb") -) -# Logger -logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) -log_file = os.path.join(local_scratch.path, "pytest_rest_api.log") -file_handler = logging.FileHandler(log_file) -formatter = logging.Formatter("%(levelname)s - %(message)s") -file_handler.setFormatter(formatter) -logger.addHandler(file_handler) +def release_logger(logger): + for handler in logger.handlers[:]: + handler.close() + logger.removeHandler(handler) -logging.StreamHandler() -formatter = logging.Formatter("%(levelname)s - %(message)s") -console_handler = logging.StreamHandler() -console_handler.setFormatter(formatter) -logger.addHandler(console_handler) + +from ansys.aedt.toolkits.common.backend.rest_api import app @pytest.fixture(scope="session") -def client(request): +def client(common_temp_dir): + logger = create_logger(common_temp_dir, "pytest_rest_api.log") + logger.info("Client initialization") with app.test_client() as client: - properties = { + new_properties = { "aedt_version": config["desktop_version"], "non_graphical": config["non_graphical"], - "use_grpc": config.get("use_grpc", True), + "use_grpc": config["use_grpc"], "debug": config["debug"], } - client.put("/properties", json=properties) + client.put("/properties", json=new_properties) client.post("/launch_aedt") response = client.get("/wait_thread", json=60) - client.post("/open_project", json=aedt_scratch) - assert response.status_code == 200 - yield client - close_properties = {"close_projects": True, "close_on_exit": True} - client.post("/close_aedt", json=close_properties) - - if request.session.testsfailed == 0: - cleanup_process() - - -failed_tests = set() + if response.status_code == 200: + aedt_project = pathlib.Path(common_temp_dir, "input_data", "Test.aedt") + open_project_response = client.post("/open_project", json=str(aedt_project)) + if open_project_response.status_code == 200: + yield client + else: + logger.error("Open project failed") + close_properties = {"close_projects": True, "close_on_exit": True} + client.post("/close_aedt", json=close_properties) + else: + logger.error("Launch AEDT failed") + + # Check if any test has failed + if not failed_tests: + logger.info(f"All tests passed successfully") + release_logger(logger) + shutil.rmtree(pathlib.Path(common_temp_dir.parent), ignore_errors=True) + else: + for failed_test in failed_tests: + logger.error(f"FAILED: {failed_test.name}") + release_logger(logger) def pytest_runtest_makereport(item, call): if call.excinfo is not None and call.excinfo.typename == "AssertionError": failed_tests.add(item) - - -@pytest.fixture(scope="session") -def aedt_example(): - return aedt_scratch - - -@pytest.fixture(scope="session") -def assert_handler(request): - def finalizer(): - # Code to run after the test - logger.info("Test Teardown") - # Check if any test has failed during the session - if request.session.testsfailed != 0: - # Additional code to run when an assert fails - for failed_test in failed_tests: - logger.error(f"FAILED: {failed_test.name}") - - request.addfinalizer(finalizer) - - return assert_handler - - -def cleanup_process(): - """Cleanup process after the test is completed.""" - for handler in logger.handlers: - if isinstance(handler, logging.FileHandler): - handler.close() - shutil.rmtree(local_scratch.path, ignore_errors=True) diff --git a/tests/backend/tests_rest_api/models.py b/tests/backend/tests_rest_api/models.py new file mode 100644 index 00000000..e160030f --- /dev/null +++ b/tests/backend/tests_rest_api/models.py @@ -0,0 +1,57 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import json +import os + +from pydantic import BaseModel + +from ansys.aedt.toolkits.common.backend.models import CommonProperties +from ansys.aedt.toolkits.common.backend.models import common_properties + + +class BackendProperties(BaseModel): + """Store toolkit properties.""" + + +class Properties(BackendProperties, CommonProperties, validate_assignment=True): + """Store all properties.""" + + +backend_properties = {} +if os.path.expanduser(os.path.join(os.path.dirname(__file__), "backend_properties.json")): + with open(os.path.join(os.path.dirname(__file__), "backend_properties.json")) as file_handler: + backend_properties = json.load(file_handler) + +toolkit_property = {} +if backend_properties: + for backend_key in backend_properties: + if hasattr(common_properties, backend_key): + setattr(common_properties, backend_key, backend_properties[backend_key]) + else: + toolkit_property[backend_key] = backend_properties[backend_key] + +new_common_properties = {} +for common_key in common_properties: + new_common_properties[common_key[0]] = common_key[1] + +properties = Properties(**toolkit_property, **new_common_properties) diff --git a/tests/backend/tests_rest_api/test_rest_api.py b/tests/backend/tests_rest_api/test_rest_api.py index df9a2425..055ba4b8 100644 --- a/tests/backend/tests_rest_api/test_rest_api.py +++ b/tests/backend/tests_rest_api/test_rest_api.py @@ -1,27 +1,51 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import json import os +import pytest from ansys.aedt.toolkits.common.backend.api import ToolkitThreadStatus +@pytest.mark.tests_rest_api class TestRESTAPI: - def test_00_get_status(self, client, assert_handler): + def test_00_get_status(self, client): response = client.get("/status") assert response.status_code == 200 data = json.loads(response.data.decode("utf-8")) assert data == ToolkitThreadStatus.IDLE.value - def test_01_health(self, client, assert_handler): + def test_01_health(self, client): response = client.get("/health") assert response.status_code == 200 - def test_02_get_properties(self, client, assert_handler): + def test_02_get_properties(self, client): response = client.get("/properties") data = json.loads(response.data.decode("utf-8")) assert response.status_code == 200 assert data.get("log_file") - def test_03_set_properties(self, client, assert_handler): + def test_03_set_properties(self, client): new_properties = { "port": "5002", } @@ -31,29 +55,29 @@ def test_03_set_properties(self, client, assert_handler): data = json.loads(response.data.decode("utf-8")) assert data.get("port") == 5002 - def test_04_installed_versions(self, client, assert_handler): + def test_04_installed_versions(self, client): response = client.get("/installed_versions") assert response.status_code == 200 data = json.loads(response.data.decode("utf-8")) assert isinstance(data, list) - def test_05_aedt_sessions(self, client, assert_handler): + def test_05_aedt_sessions(self, client): response = client.get("/aedt_sessions") assert response.status_code == 200 data = json.loads(response.data.decode("utf-8")) assert isinstance(data, dict) - def test_06_connect_design(self, client, assert_handler): + def test_06_connect_design(self, client): response = client.post("/connect_design", json={"aedtapp": "Icepak"}) assert response.status_code == 200 - def test_07_save_project(self, client, assert_handler, aedt_example): - new_project = os.path.join(os.path.dirname(aedt_example), "New.aedt") + def test_07_save_project(self, client, common_temp_dir): + new_project = os.path.join(common_temp_dir, "input_data", "New.aedt") response = client.post("/save_project", json=new_project) assert response.status_code == 200 assert os.path.exists(new_project) - def test_08_get_design_names(self, client, assert_handler): + def test_08_get_design_names(self, client): response = client.get("/design_names") assert response.status_code == 200 data = json.loads(response.data.decode("utf-8")) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..73f9c5ce --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,39 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +""" +Common conftest +""" +import os +from pathlib import Path +import shutil + +import pytest + + +@pytest.fixture(scope="session") +def common_temp_dir(tmp_path_factory): + tmp_dir = tmp_path_factory.mktemp("test_common_toolkit_workflows", numbered=True) + src_folder = os.path.join(Path(__file__).parent, "input_data") + shutil.copytree(src_folder, os.path.join(tmp_dir, "input_data")) + + yield tmp_dir