diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py index 81a904c953de..7421ce7e3cc9 100644 --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -470,11 +470,12 @@ def __str__(self) -> str: else: return str(self.unsanitized.get_file_name()) + @property + def file_name(self) -> str: + return str(self) + def __getattr__(self, key: Any) -> Any: - if self.false_path is not None and key in ("get_file_name", "file_name"): - # Path to dataset was rewritten for this job. - return lambda *args, **kwargs: self.false_path - elif key in ("extra_files_path", "files_path"): + if key in ("extra_files_path", "files_path"): if not self.compute_environment: # Only happens in WrappedParameters context, refactor! return self.unsanitized.extra_files_path diff --git a/test/functional/tools/md5sum.xml b/test/functional/tools/md5sum.xml index 252e051ca48e..577f873e6081 100644 --- a/test/functional/tools/md5sum.xml +++ b/test/functional/tools/md5sum.xml @@ -1,6 +1,6 @@ - cp $input $output + cp '$input.file_name' '$output' diff --git a/test/unit/app/tools/test_wrappers.py b/test/unit/app/tools/test_wrappers.py index 69cca55f204f..a7be2e271d1b 100644 --- a/test/unit/app/tools/test_wrappers.py +++ b/test/unit/app/tools/test_wrappers.py @@ -207,7 +207,7 @@ def test_dataset_wrapper(): dataset = cast(DatasetInstance, MockDataset()) wrapper = DatasetFilenameWrapper(dataset) assert str(wrapper) == MOCK_DATASET_PATH - assert wrapper.get_file_name() == MOCK_DATASET_PATH + assert wrapper.file_name == MOCK_DATASET_PATH assert wrapper.ext == MOCK_DATASET_EXT @@ -219,7 +219,7 @@ def test_dataset_wrapper_false_path(): dataset, compute_environment=cast(ComputeEnvironment, MockComputeEnvironment(false_path=new_path)) ) assert str(wrapper) == new_path - assert wrapper.get_file_name() == new_path + assert wrapper.file_name == new_path class MockComputeEnvironment: