[pre-commit.ci] pre-commit autoupdate (#551) #1627
GitHub Actions / Test Report ubuntu-latest:3.12
failed
Mar 11, 2025 in 0s
89 tests run, 83 passed, 5 skipped, 1 failed.
Annotations
Check failure on line 290 in tests/jms/test_projects.py
github-actions / Test Report ubuntu-latest:3.12
test_projects.test_copy_exec_script
ansys.hps.client.exceptions.HPSError: Copying of default execution script mechanical-exec_mechanical.py failed
Raw output
client = <ansys.hps.client.client.Client object at 0x7fa93474dca0>
def test_copy_exec_script(client):
jms_api = JmsApi(client)
proj_name = f"test_copy_exec_script"
proj = Project(name=proj_name)
proj = jms_api.create_project(proj)
project_api = ProjectApi(client, proj.id)
ansys_short_version = f"v{ansys_version[2:4]}{ansys_version[6]}"
script_names = [f"mapdl-{ansys_short_version}-exec_mapdl", "mechanical-exec_mechanical"]
for script_name in script_names:
> file = project_api.copy_default_execution_script(f"{script_name}.py")
tests/jms/test_projects.py:290:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ansys.hps.client.jms.api.project_api.ProjectApi object at 0x7fa934674890>
filename = 'mechanical-exec_mechanical.py'
def copy_default_execution_script(self, filename: str) -> File:
"""Copy a default execution script to the current project.
Example:
>>> file = project_api.copy_default_execution_script("exec_mapdl.py")
"""
# create file resource
name = os.path.splitext(filename)[0]
file = File(name=name, evaluation_path=filename, type="application/x-python-code")
file = self.create_files([file])[0]
# query location of default execution scripts from server
jms_api = JmsApi(self.client)
info = jms_api.get_api_info()
execution_script_default_bucket = info["settings"]["execution_script_default_bucket"]
# server side copy of the file to project bucket
self.client._start_dt_worker()
src = StoragePath(path=f"{execution_script_default_bucket}/{filename}")
dst = StoragePath(path=f"{self.project_id}/{file.storage_id}")
log.info(f"Copying default execution script {filename}")
op = self.client.dt_api.copy([SrcDst(src=src, dst=dst)])
op = self.client.dt_api.wait_for(op.id)[0]
log.debug(f"Operation {op.state}")
if op.state != OperationState.Succeeded:
> raise HPSError(f"Copying of default execution script {filename} failed")
E ansys.hps.client.exceptions.HPSError: Copying of default execution script mechanical-exec_mechanical.py failed
.tox/py312-coverage/lib/python3.12/site-packages/ansys/hps/client/jms/api/project_api.py:634: HPSError
Loading