From 3b5978cdc1da34831d54bfa10509b1895c1b044e Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 3 Mar 2026 12:46:52 -0800 Subject: [PATCH 1/6] added delete_recod_set and selete_file_view --- synapseclient/models/curation.py | 157 +++++++++++++++++- .../models/async/test_curation_async.py | 140 +++++++++++++++- 2 files changed, 290 insertions(+), 7 deletions(-) diff --git a/synapseclient/models/curation.py b/synapseclient/models/curation.py index 6b3eb5843..7b25de8f4 100644 --- a/synapseclient/models/curation.py +++ b/synapseclient/models/curation.py @@ -45,7 +45,7 @@ class FileBasedMetadataTaskProperties: A CurationTaskProperties for file-based data, describing where data is uploaded and a view which contains the annotations. - Represents a [Synapse FileBasedMetadataTaskProperties](https://rest-docs.synapse.org/org/sagebionetworks/repo/model/curation/metadata/FileBasedMetadataTaskProperties.html). + Represents a [Synapse FileBasedMetadataTaskProperties](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/curation/metadata/FileBasedMetadataTaskProperties.html). Attributes: upload_folder_id: The synId of the folder where data files of this type are to be uploaded @@ -94,7 +94,7 @@ class RecordBasedMetadataTaskProperties: """ A CurationTaskProperties for record-based metadata. - Represents a [Synapse RecordBasedMetadataTaskProperties](https://rest-docs.synapse.org/org/sagebionetworks/repo/model/curation/metadata/RecordBasedMetadataTaskProperties.html). + Represents a [Synapse RecordBasedMetadataTaskProperties](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/curation/metadata/RecordBasedMetadataTaskProperties.html). Attributes: record_set_id: The synId of the RecordSet that will contain all record-based metadata @@ -213,11 +213,21 @@ def get(self, *, synapse_client: Optional[Synapse] = None) -> "CurationTask": """ return self - def delete(self, *, synapse_client: Optional[Synapse] = None) -> None: + def delete( + self, + delete_file_view: bool = False, + delete_record_set: bool = False, + *, + synapse_client: Optional[Synapse] = None, + ) -> None: """ Deletes a CurationTask from Synapse. Arguments: + delete_file_view: If True, the associated EntityView will also be deleted + if the task is a FileBasedMetadataTask. Defaults to False. + delete_record_set: If True, the associated RecordSet will also be deleted + if the task is a RecordBasedMetadataTask. Defaults to False. synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor. @@ -238,6 +248,34 @@ def delete(self, *, synapse_client: Optional[Synapse] = None) -> None: task = CurationTask(task_id=123) task.delete() ``` + + Example: Delete a curation task and its associated file view +   + + ```python + from synapseclient import Synapse + from synapseclient.models import CurationTask + + syn = Synapse() + syn.login() + + task = CurationTask(task_id=123) + task.delete(delete_file_view=True) + ``` + + Example: Delete a curation task and its associated record set +   + + ```python + from synapseclient import Synapse + from synapseclient.models import CurationTask + + syn = Synapse() + syn.login() + + task = CurationTask(task_id=123) + task.delete(delete_record_set=True) + ``` """ return None @@ -602,17 +640,32 @@ async def main(): self._set_last_persistent_instance() return self - async def delete_async(self, *, synapse_client: Optional[Synapse] = None) -> None: + async def delete_async( + self, + delete_file_view: bool = False, + delete_record_set: bool = False, + *, + synapse_client: Optional[Synapse] = None, + ) -> None: """ Deletes a CurationTask from Synapse. Arguments: + delete_file_view: If True, the associated EntityView will also be deleted + if the task is a FileBasedMetadataTask. Defaults to False. + delete_record_set: If True, the associated RecordSet will also be deleted + if the task is a RecordBasedMetadataTask. Defaults to False. synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor. Raises: ValueError: If the CurationTask object does not have a task_id. + ValueError: If delete_file_view=True but the task is not a FileBasedMetadataTask or does not have a + file_view_id. + ValueError: If delete_record_set=True but the task is not a RecordBasedMetadataTask or does not have a + record_set_id. + Example: Delete a curation task asynchronously   @@ -632,6 +685,44 @@ async def main(): asyncio.run(main()) ``` + + Example: Delete a curation task and its associated file view asynchronously +   + + ```python + import asyncio + from synapseclient import Synapse + from synapseclient.models import CurationTask + + syn = Synapse() + syn.login() + + async def main(): + task = CurationTask(task_id=123) + await task.delete_async(delete_file_view=True) + print("Task and file view deleted successfully") + + asyncio.run(main()) + ``` + + Example: Delete a curation task and its associated record set asynchronously +   + + ```python + import asyncio + from synapseclient import Synapse + from synapseclient.models import CurationTask + + syn = Synapse() + syn.login() + + async def main(): + task = CurationTask(task_id=123) + await task.delete_async(delete_record_set=True) + print("Task and record set deleted successfully") + + asyncio.run(main()) + ``` """ if not self.task_id: raise ValueError("task_id is required to delete a CurationTask") @@ -642,6 +733,64 @@ async def main(): } ) + if delete_file_view or delete_record_set: + if not self.task_properties: + await self.get_async(synapse_client=synapse_client) + + if delete_file_view: + if ( + isinstance(self.task_properties, FileBasedMetadataTaskProperties) + and self.task_properties.file_view_id + ): + from synapseclient.models.entityview import EntityView + + await EntityView(id=self.task_properties.file_view_id).delete_async( + synapse_client=synapse_client + ) + + elif not isinstance(self.task_properties, FileBasedMetadataTaskProperties): + raise ValueError( + ( + "The `delete_file_view` parameter was set to True, " + "but the task is not configured as a FileBasedMetadataTask." + ) + ) + else: + raise ValueError( + ( + "The `delete_file_view` parameter was set to True, " + "but the task does not have an associated file view ID." + ) + ) + + if delete_record_set: + if ( + isinstance(self.task_properties, RecordBasedMetadataTaskProperties) + and self.task_properties.record_set_id + ): + from synapseclient.models.recordset import RecordSet + + await RecordSet(id=self.task_properties.record_set_id).delete_async( + synapse_client=synapse_client + ) + + elif not isinstance( + self.task_properties, RecordBasedMetadataTaskProperties + ): + raise ValueError( + ( + "The `delete_record_set` parameter was set to True, " + "but the task is not configured as a RecordBasedMetadataTask." + ) + ) + else: + raise ValueError( + ( + "The `delete_record_set` parameter was set to True, " + "but the task does not have an associated record set ID." + ) + ) + await delete_curation_task(task_id=self.task_id, synapse_client=synapse_client) async def store_async( diff --git a/tests/integration/synapseclient/models/async/test_curation_async.py b/tests/integration/synapseclient/models/async/test_curation_async.py index a07183e67..7d37d9073 100644 --- a/tests/integration/synapseclient/models/async/test_curation_async.py +++ b/tests/integration/synapseclient/models/async/test_curation_async.py @@ -10,6 +10,7 @@ from synapseclient import Synapse from synapseclient.core.exceptions import SynapseHTTPError +from synapseclient.core.utils import make_bogus_uuid_file from synapseclient.models import ( Column, ColumnType, @@ -412,7 +413,35 @@ async def folder_with_view( return folder, entity_view - async def test_delete_curation_task_async( + @pytest.fixture(scope="class") + async def folder_with_record_set( + self, + project_model: Project, + syn: Synapse, + schedule_for_cleanup: Callable[..., None], + ) -> tuple[Folder, EntityView]: + """Create a folder with a a record set for record-based testing.""" + # Create a folder + folder = await Folder( + name=str(uuid.uuid4()), + parent_id=project_model.id, + ).store_async(synapse_client=syn) + schedule_for_cleanup(folder.id) + + filename = make_bogus_uuid_file() + schedule_for_cleanup(filename) + + record_set = await RecordSet( + name=str(uuid.uuid4()), + parent_id=folder.id, + path=filename, + upsert_keys=["xxx"], + ).store_async(synapse_client=syn) + schedule_for_cleanup(record_set.id) + + return folder, record_set + + async def test_delete_file_based_curation_task_async( self, project_model: Project, folder_with_view: tuple[Folder, EntityView] ) -> None: # GIVEN a project, folder, and entity view @@ -434,13 +463,118 @@ async def test_delete_curation_task_async( task_id = curation_task.task_id assert task_id is not None - # WHEN I delete the task asynchronously - await curation_task.delete_async(synapse_client=self.syn) + # WHEN I delete the task asynchronously, without deleting the file view + await curation_task.delete_async( + synapse_client=self.syn, delete_file_view=False + ) # THEN the task should be deleted and no longer retrievable with pytest.raises(SynapseHTTPError): await CurationTask(task_id=task_id).get_async(synapse_client=self.syn) + # AND the file view should not be deleted + await EntityView(entity_view.id).get_async(synapse_client=self.syn) + + async def test_delete_file_based_curation_task_and_fileview_async( + self, project_model: Project, folder_with_view: tuple[Folder, EntityView] + ) -> None: + # GIVEN a project, folder, and entity view + folder, entity_view = folder_with_view + + # GIVEN an existing curation task + data_type = f"test_data_type_{str(uuid.uuid4()).replace('-', '_')}" + task_properties = FileBasedMetadataTaskProperties( + upload_folder_id=folder.id, + file_view_id=entity_view.id, + ) + curation_task = await CurationTask( + data_type=data_type, + project_id=project_model.id, + instructions="Task to be deleted", + task_properties=task_properties, + ).store_async(synapse_client=self.syn) + + task_id = curation_task.task_id + assert task_id is not None + + # WHEN I delete the task and fileview asynchronously + await curation_task.delete_async(synapse_client=self.syn, delete_file_view=True) + + # THEN the task should be deleted and no longer retrievable + with pytest.raises(SynapseHTTPError): + await CurationTask(task_id=task_id).get_async(synapse_client=self.syn) + + # AND the file view should be deleted and no longer retrievable + with pytest.raises(SynapseHTTPError): + await EntityView(entity_view.id).get_async(synapse_client=self.syn) + + async def test_delete_record_based_curation_task_async( + self, project_model: Project, folder_with_record_set: tuple[Folder, EntityView] + ) -> None: + # GIVEN a folder, and record set + _, record_set = folder_with_record_set + + # GIVEN an existing curation task + data_type = f"test_data_type_{str(uuid.uuid4()).replace('-', '_')}" + task_properties = RecordBasedMetadataTaskProperties( + record_set_id=record_set.id, + ) + curation_task = await CurationTask( + data_type=data_type, + project_id=project_model.id, + instructions="Task to be deleted", + task_properties=task_properties, + ).store_async(synapse_client=self.syn) + + task_id = curation_task.task_id + assert task_id is not None + + # WHEN I delete the task asynchronously, without deleting the record set + await curation_task.delete_async( + synapse_client=self.syn, delete_record_set=False + ) + + # THEN the task should be deleted and no longer retrievable + with pytest.raises(SynapseHTTPError): + await CurationTask(task_id=task_id).get_async(synapse_client=self.syn) + + # AND the record set should not be deleted + await RecordSet(record_set.id).get_async(synapse_client=self.syn) + + async def test_delete_record_based_curation_task_and_record_set_async( + self, project_model: Project, folder_with_record_set: tuple[Folder, EntityView] + ) -> None: + # GIVEN a folder, and record set + _, record_set = folder_with_record_set + + # GIVEN an existing curation task + data_type = f"test_data_type_{str(uuid.uuid4()).replace('-', '_')}" + task_properties = RecordBasedMetadataTaskProperties( + record_set_id=record_set.id, + ) + curation_task = await CurationTask( + data_type=data_type, + project_id=project_model.id, + instructions="Task to be deleted", + task_properties=task_properties, + ).store_async(synapse_client=self.syn) + + task_id = curation_task.task_id + assert task_id is not None + + # WHEN I delete the task asynchronously, without deleting the record set + await curation_task.delete_async( + synapse_client=self.syn, delete_record_set=True + ) + + # THEN the task should be deleted and no longer retrievable + with pytest.raises(SynapseHTTPError): + await CurationTask(task_id=task_id).get_async(synapse_client=self.syn) + + # AND the record set should be deleted and not retrievable + with pytest.raises(SynapseHTTPError): + await RecordSet(record_set.id).get_async(synapse_client=self.syn) + async def test_delete_validation_error_async(self) -> None: # GIVEN a CurationTask without a task_id curation_task = CurationTask() From 43b8d27c3e8b4e98a6a2f6323c677a4173da750f Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 3 Mar 2026 14:10:29 -0800 Subject: [PATCH 2/6] merged both paramaters into delete_source --- synapseclient/models/curation.py | 119 ++++-------------- .../models/async/test_curation_async.py | 17 ++- 2 files changed, 30 insertions(+), 106 deletions(-) diff --git a/synapseclient/models/curation.py b/synapseclient/models/curation.py index 7b25de8f4..62291bd20 100644 --- a/synapseclient/models/curation.py +++ b/synapseclient/models/curation.py @@ -215,8 +215,7 @@ def get(self, *, synapse_client: Optional[Synapse] = None) -> "CurationTask": def delete( self, - delete_file_view: bool = False, - delete_record_set: bool = False, + delete_source: bool = False, *, synapse_client: Optional[Synapse] = None, ) -> None: @@ -224,10 +223,8 @@ def delete( Deletes a CurationTask from Synapse. Arguments: - delete_file_view: If True, the associated EntityView will also be deleted - if the task is a FileBasedMetadataTask. Defaults to False. - delete_record_set: If True, the associated RecordSet will also be deleted - if the task is a RecordBasedMetadataTask. Defaults to False. + delete_source: If True, the associated source data (EntityView or RecordSet) will also be deleted + if the task is a FileBasedMetadataTask or RecordBasedMetadataTask respectively. Defaults to False. synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor. @@ -249,7 +246,7 @@ def delete( task.delete() ``` - Example: Delete a curation task and its associated file view + Example: Delete a curation task and its associated data source   ```python @@ -260,21 +257,7 @@ def delete( syn.login() task = CurationTask(task_id=123) - task.delete(delete_file_view=True) - ``` - - Example: Delete a curation task and its associated record set -   - - ```python - from synapseclient import Synapse - from synapseclient.models import CurationTask - - syn = Synapse() - syn.login() - - task = CurationTask(task_id=123) - task.delete(delete_record_set=True) + task.delete(delete_source=True) ``` """ return None @@ -642,8 +625,7 @@ async def main(): async def delete_async( self, - delete_file_view: bool = False, - delete_record_set: bool = False, + delete_source: bool = False, *, synapse_client: Optional[Synapse] = None, ) -> None: @@ -651,20 +633,14 @@ async def delete_async( Deletes a CurationTask from Synapse. Arguments: - delete_file_view: If True, the associated EntityView will also be deleted - if the task is a FileBasedMetadataTask. Defaults to False. - delete_record_set: If True, the associated RecordSet will also be deleted - if the task is a RecordBasedMetadataTask. Defaults to False. + delete_source: If True, the associated source data (EntityView or RecordSet) will also be deleted + if the task is a FileBasedMetadataTask or RecordBasedMetadataTask respectively. Defaults to False. synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor. Raises: ValueError: If the CurationTask object does not have a task_id. - ValueError: If delete_file_view=True but the task is not a FileBasedMetadataTask or does not have a - file_view_id. - ValueError: If delete_record_set=True but the task is not a RecordBasedMetadataTask or does not have a - record_set_id. Example: Delete a curation task asynchronously @@ -686,26 +662,7 @@ async def main(): asyncio.run(main()) ``` - Example: Delete a curation task and its associated file view asynchronously -   - - ```python - import asyncio - from synapseclient import Synapse - from synapseclient.models import CurationTask - - syn = Synapse() - syn.login() - - async def main(): - task = CurationTask(task_id=123) - await task.delete_async(delete_file_view=True) - print("Task and file view deleted successfully") - - asyncio.run(main()) - ``` - - Example: Delete a curation task and its associated record set asynchronously + Example: Delete a curation task and its associated data source asynchronously   ```python @@ -718,7 +675,7 @@ async def main(): async def main(): task = CurationTask(task_id=123) - await task.delete_async(delete_record_set=True) + await task.delete_async(delete_source=True) print("Task and record set deleted successfully") asyncio.run(main()) @@ -733,62 +690,32 @@ async def main(): } ) - if delete_file_view or delete_record_set: + if delete_source: if not self.task_properties: await self.get_async(synapse_client=synapse_client) - - if delete_file_view: - if ( - isinstance(self.task_properties, FileBasedMetadataTaskProperties) - and self.task_properties.file_view_id - ): - from synapseclient.models.entityview import EntityView + if isinstance(self.task_properties, FileBasedMetadataTaskProperties): + if not self.task_properties.file_view_id: + raise ValueError( + "file_view_id is required to delete the associated file view" + ) + from synapseclient.models import EntityView await EntityView(id=self.task_properties.file_view_id).delete_async( synapse_client=synapse_client ) - - elif not isinstance(self.task_properties, FileBasedMetadataTaskProperties): - raise ValueError( - ( - "The `delete_file_view` parameter was set to True, " - "but the task is not configured as a FileBasedMetadataTask." + elif isinstance(self.task_properties, RecordBasedMetadataTaskProperties): + if not self.task_properties.record_set_id: + raise ValueError( + "record_set_id is required to delete the associated record set" ) - ) - else: - raise ValueError( - ( - "The `delete_file_view` parameter was set to True, " - "but the task does not have an associated file view ID." - ) - ) - - if delete_record_set: - if ( - isinstance(self.task_properties, RecordBasedMetadataTaskProperties) - and self.task_properties.record_set_id - ): - from synapseclient.models.recordset import RecordSet + from synapseclient.models import RecordSet await RecordSet(id=self.task_properties.record_set_id).delete_async( synapse_client=synapse_client ) - - elif not isinstance( - self.task_properties, RecordBasedMetadataTaskProperties - ): - raise ValueError( - ( - "The `delete_record_set` parameter was set to True, " - "but the task is not configured as a RecordBasedMetadataTask." - ) - ) else: raise ValueError( - ( - "The `delete_record_set` parameter was set to True, " - "but the task does not have an associated record set ID." - ) + "Failed to retrieve task properties for deletion. Cannot delete source." ) await delete_curation_task(task_id=self.task_id, synapse_client=synapse_client) diff --git a/tests/integration/synapseclient/models/async/test_curation_async.py b/tests/integration/synapseclient/models/async/test_curation_async.py index 7d37d9073..b94399abe 100644 --- a/tests/integration/synapseclient/models/async/test_curation_async.py +++ b/tests/integration/synapseclient/models/async/test_curation_async.py @@ -464,9 +464,7 @@ async def test_delete_file_based_curation_task_async( assert task_id is not None # WHEN I delete the task asynchronously, without deleting the file view - await curation_task.delete_async( - synapse_client=self.syn, delete_file_view=False - ) + await curation_task.delete_async(synapse_client=self.syn, delete_source=False) # THEN the task should be deleted and no longer retrievable with pytest.raises(SynapseHTTPError): @@ -498,12 +496,15 @@ async def test_delete_file_based_curation_task_and_fileview_async( assert task_id is not None # WHEN I delete the task and fileview asynchronously - await curation_task.delete_async(synapse_client=self.syn, delete_file_view=True) + await curation_task.delete_async(synapse_client=self.syn, delete_source=True) # THEN the task should be deleted and no longer retrievable with pytest.raises(SynapseHTTPError): await CurationTask(task_id=task_id).get_async(synapse_client=self.syn) + print("##########") + print(entity_view.id) + print("##########") # AND the file view should be deleted and no longer retrievable with pytest.raises(SynapseHTTPError): await EntityView(entity_view.id).get_async(synapse_client=self.syn) @@ -530,9 +531,7 @@ async def test_delete_record_based_curation_task_async( assert task_id is not None # WHEN I delete the task asynchronously, without deleting the record set - await curation_task.delete_async( - synapse_client=self.syn, delete_record_set=False - ) + await curation_task.delete_async(synapse_client=self.syn, delete_source=False) # THEN the task should be deleted and no longer retrievable with pytest.raises(SynapseHTTPError): @@ -563,9 +562,7 @@ async def test_delete_record_based_curation_task_and_record_set_async( assert task_id is not None # WHEN I delete the task asynchronously, without deleting the record set - await curation_task.delete_async( - synapse_client=self.syn, delete_record_set=True - ) + await curation_task.delete_async(synapse_client=self.syn, delete_source=True) # THEN the task should be deleted and no longer retrievable with pytest.raises(SynapseHTTPError): From fc5201408e03570dc3555c4c9154846a1f70a210 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 3 Mar 2026 14:12:56 -0800 Subject: [PATCH 3/6] added value error to docstring --- synapseclient/models/curation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/synapseclient/models/curation.py b/synapseclient/models/curation.py index 62291bd20..df9322684 100644 --- a/synapseclient/models/curation.py +++ b/synapseclient/models/curation.py @@ -641,7 +641,8 @@ async def delete_async( Raises: ValueError: If the CurationTask object does not have a task_id. - + ValueError: If delete_source is True but the task properties are not properly set + to identify the source to delete. Example: Delete a curation task asynchronously   From 48a3e3a722c212fc13d725866b73e7c34e86673f Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 3 Mar 2026 14:44:15 -0800 Subject: [PATCH 4/6] redid logic --- synapseclient/models/curation.py | 13 ++++++++++--- .../models/async/test_curation_async.py | 3 --- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/synapseclient/models/curation.py b/synapseclient/models/curation.py index df9322684..89107c1d2 100644 --- a/synapseclient/models/curation.py +++ b/synapseclient/models/curation.py @@ -694,29 +694,36 @@ async def main(): if delete_source: if not self.task_properties: await self.get_async(synapse_client=synapse_client) + if isinstance(self.task_properties, FileBasedMetadataTaskProperties): if not self.task_properties.file_view_id: raise ValueError( - "file_view_id is required to delete the associated file view" + "Cannot delete Fileview: " + "'file_view_id' attribute is missing." ) from synapseclient.models import EntityView await EntityView(id=self.task_properties.file_view_id).delete_async( synapse_client=synapse_client ) + elif isinstance(self.task_properties, RecordBasedMetadataTaskProperties): if not self.task_properties.record_set_id: raise ValueError( - "record_set_id is required to delete the associated record set" + "Cannot delete RecordSet: " + "'record_set_id' attribute is missing." ) from synapseclient.models import RecordSet await RecordSet(id=self.task_properties.record_set_id).delete_async( synapse_client=synapse_client ) + else: raise ValueError( - "Failed to retrieve task properties for deletion. Cannot delete source." + "'task_property' attribute is None. " + "Deletion only supports FileBasedMetadataTaskProperties or " + "RecordBasedMetadataTaskProperties." ) await delete_curation_task(task_id=self.task_id, synapse_client=synapse_client) diff --git a/tests/integration/synapseclient/models/async/test_curation_async.py b/tests/integration/synapseclient/models/async/test_curation_async.py index b94399abe..b486ed49a 100644 --- a/tests/integration/synapseclient/models/async/test_curation_async.py +++ b/tests/integration/synapseclient/models/async/test_curation_async.py @@ -502,9 +502,6 @@ async def test_delete_file_based_curation_task_and_fileview_async( with pytest.raises(SynapseHTTPError): await CurationTask(task_id=task_id).get_async(synapse_client=self.syn) - print("##########") - print(entity_view.id) - print("##########") # AND the file view should be deleted and no longer retrievable with pytest.raises(SynapseHTTPError): await EntityView(entity_view.id).get_async(synapse_client=self.syn) From d9f25f79d1c0d58ac722ae46ef4c368b0c7111fc Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 4 Mar 2026 08:18:49 -0800 Subject: [PATCH 5/6] change fixtures from class to function --- .../synapseclient/models/async/test_curation_async.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/synapseclient/models/async/test_curation_async.py b/tests/integration/synapseclient/models/async/test_curation_async.py index b486ed49a..14111aa13 100644 --- a/tests/integration/synapseclient/models/async/test_curation_async.py +++ b/tests/integration/synapseclient/models/async/test_curation_async.py @@ -371,7 +371,7 @@ def init(self, syn: Synapse, schedule_for_cleanup: Callable[..., None]) -> None: self.syn = syn self.schedule_for_cleanup = schedule_for_cleanup - @pytest.fixture(scope="class") + @pytest.fixture(scope="function") async def folder_with_view( self, project_model: Project, @@ -413,7 +413,7 @@ async def folder_with_view( return folder, entity_view - @pytest.fixture(scope="class") + @pytest.fixture(scope="function") async def folder_with_record_set( self, project_model: Project, From 6b20dac158309102d60c9768a9f525b2aab510e2 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 4 Mar 2026 08:44:47 -0800 Subject: [PATCH 6/6] added task cleanup to doc --- docs/guides/extensions/curator/metadata_curation.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/guides/extensions/curator/metadata_curation.md b/docs/guides/extensions/curator/metadata_curation.md index ddc2b6f2d..ea13b93f2 100644 --- a/docs/guides/extensions/curator/metadata_curation.md +++ b/docs/guides/extensions/curator/metadata_curation.md @@ -395,6 +395,9 @@ if validation_df is not None: # Clean up temporary file if os.path.exists(temp_csv): os.unlink(temp_csv) + +# Clean up RecordSet and CurationTask +curation_task.delete(delete_source=True) ``` In this example you would expect to get results like: