Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .github/ansys_dpf_gate-0.2.0-py3-none-any.whl
Binary file not shown.
Binary file modified .github/ansys_dpf_gatebin-0.2.0-py3-none-manylinux1_x86_64.whl
Binary file not shown.
Binary file modified .github/ansys_dpf_gatebin-0.2.0-py3-none-manylinux_2_17_x86_64.whl
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
PACKAGE_NAME: ansys-dpf-core
MODULE: core
ANSYS_VERSION: 231
extra: "--pre --find-links .github/"
extra: "--find-links .github/"

jobs:
style:
Expand Down
2 changes: 2 additions & 0 deletions ansys/dpf/core/server_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def _get_dll_path(name, ansys_path=None):
if ansys_path is None:
awp_root = "AWP_ROOT" + str(__ansys_version__)
ANSYS_INSTALL = os.environ.get(awp_root, None)
if ANSYS_INSTALL is None:
ANSYS_INSTALL = core.misc.find_ansys()
else:
ANSYS_INSTALL = ansys_path
if ANSYS_INSTALL is None:
Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ def server_clayer(request):

@pytest.fixture()
def restore_awp_root():
awp_root_name = "AWP_ROOT" + core.misc.__ansys_version__
ver_to_check = core._version.server_to_ansys_version[str(core.SERVER.version)]
ver_to_check = ver_to_check[2:4] + ver_to_check[5:6]
awp_root_name = "AWP_ROOT" + ver_to_check
awp_root_save = os.environ.get(awp_root_name, None)
yield
# restore awp_root
Expand Down
26 changes: 16 additions & 10 deletions tests/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ def reset_server():
reason="Ans.Dpf.Grpc.bat and .sh need AWP_ROOT221 for 221 install",
)
def test_start_local_custom_ansys_path(self, server_config):
path = os.environ["AWP_ROOT" + str(core.misc.__ansys_version__)]
ver_to_check = core._version.server_to_ansys_version[str(core.SERVER.version)]
ver_to_check = ver_to_check[2:4] + ver_to_check[5:6]
awp_root_name = "AWP_ROOT" + ver_to_check
path = os.environ[awp_root_name]
try:
os.unsetenv("AWP_ROOT" + str(core.misc.__ansys_version__))
os.unsetenv(awp_root_name)
except:
del os.environ["AWP_ROOT" + str(core.misc.__ansys_version__)]
del os.environ[awp_root_name]
try:
server = core.start_local_server(
ansys_path=path,
Expand All @@ -80,11 +83,11 @@ def test_start_local_custom_ansys_path(self, server_config):
p = psutil.Process(server.info["server_process_id"])
assert path in p.cwd()
os.environ[
"AWP_ROOT" + str(core.misc.__ansys_version__)
awp_root_name
] = path
except Exception as e:
os.environ[
"AWP_ROOT" + str(core.misc.__ansys_version__)
awp_root_name
] = path
raise e

Expand All @@ -106,23 +109,26 @@ def test_start_local_no_ansys_path(self, server_config):
reason="Ans.Dpf.Grpc.bat and .sh need AWP_ROOT221 for 221 install",
)
def test_start_local_ansys_path_environment_variable(self, server_config):
ver_to_check = core._version.server_to_ansys_version[str(core.SERVER.version)]
ver_to_check = ver_to_check[2:4] + ver_to_check[5:6]
awp_root_name = "AWP_ROOT" + ver_to_check
awp_root = os.environ[
"AWP_ROOT" + str(core.misc.__ansys_version__)
awp_root_name
]
try:
os.environ["ANSYS_DPF_PATH"] = awp_root
try:
os.unsetenv("AWP_ROOT" + str(core.misc.__ansys_version__))
os.unsetenv(awp_root_name)
except:
del os.environ[
"AWP_ROOT" + str(core.misc.__ansys_version__)
awp_root_name
]
server = core.start_local_server(
use_docker_by_default=False, config=server_config
)
assert isinstance(server.os, str)
os.environ[
"AWP_ROOT" + str(core.misc.__ansys_version__)
awp_root_name
] = awp_root
try:
os.unsetenv("ANSYS_DPF_PATH")
Expand All @@ -131,7 +137,7 @@ def test_start_local_ansys_path_environment_variable(self, server_config):

except Exception as e:
os.environ[
"AWP_ROOT" + str(core.misc.__ansys_version__)
awp_root_name
] = awp_root
try:
os.unsetenv("ANSYS_DPF_PATH")
Expand Down
5 changes: 3 additions & 2 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,9 @@ def test_load_api_without_awp_root(restore_awp_root):

legacy_conf = ServerConfig(protocol=CommunicationProtocols.gRPC, legacy=True)
loc_serv = dpf.core.start_local_server(config=legacy_conf, as_global=False)

awp_root_name = "AWP_ROOT" + dpf.core.misc.__ansys_version__
ver_to_check = dpf.core._version.server_to_ansys_version[str(loc_serv.version)]
ver_to_check = ver_to_check[2:4] + ver_to_check[5:6]
awp_root_name = "AWP_ROOT" + ver_to_check
# delete awp_root
del os.environ[awp_root_name]

Expand Down