Skip to content

Commit 997e288

Browse files
committed
Fixing tests
1 parent 23cfc46 commit 997e288

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/ansys/mapdl/core/mapdl_grpc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,9 +2308,10 @@ def _validate_files(self, file: str, extension: Optional[str] = None) -> List[st
23082308

23092309
if self.is_local:
23102310
# filtering with glob (accepting *)
2311-
list_files = glob.glob(file, root_dir=self.directory)
2311+
list_files = glob.glob(file + extension)
2312+
23122313
else:
2313-
base_name = os.path.basename(file)
2314+
base_name = os.path.basename(file + extension)
23142315
self_files = self.list_files()
23152316

23162317
list_files = fnmatch.filter(self_files, base_name)

tests/test_grpc.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ def test_download_without_target_dir(mapdl, files_to_download, expected_output):
316316
[
317317
["txt", "myfile*", ["myfile0.txt", "myfile1.txt"]],
318318
["txt", "myfile0", ["myfile0.txt"]],
319-
["err", "file", ["file.err"]],
320-
["err", "*", ["file.err"]],
319+
[None, "file*.err", None],
320+
["err", "*", None],
321321
],
322322
)
323323
def test_download_with_extension(
@@ -327,11 +327,19 @@ def test_download_with_extension(
327327
write_tmp_in_mapdl_instance(mapdl, "myfile1")
328328

329329
list_files = mapdl.download(files_to_download, extension=extension_to_download)
330-
assert len(expected_output) == len(list_files)
331330

332-
for file_to_check in expected_output:
333-
assert file_to_check in list_files
334-
assert os.path.exists(file_to_check)
331+
if extension_to_download == "err" or files_to_download.endswith("err"):
332+
remote_list_files = mapdl.list_files()
333+
334+
assert all(
335+
[each.endswith("err") and each in remote_list_files for each in list_files]
336+
)
337+
else:
338+
assert len(expected_output) == len(list_files)
339+
340+
for file_to_check in expected_output:
341+
assert file_to_check in list_files
342+
assert os.path.exists(file_to_check)
335343

336344

337345
@skip_in_cloud # This is going to run only in local

0 commit comments

Comments
 (0)