How to use cleanup_resources method in localstack

Best Python code snippet using localstack_python

base.py

Source:base.py Github

copy

Full Screen

...33 cls._job_binaries = []34 cls._jobs = []35 @classmethod36 def resource_cleanup(cls):37 cls.cleanup_resources(getattr(cls, '_cluster_templates', []),38 cls.client.delete_cluster_template)39 cls.cleanup_resources(getattr(cls, '_node_group_templates', []),40 cls.client.delete_node_group_template)41 cls.cleanup_resources(getattr(cls, '_jobs', []), cls.client.delete_job)42 cls.cleanup_resources(getattr(cls, '_job_binaries', []),43 cls.client.delete_job_binary)44 cls.cleanup_resources(getattr(cls, '_job_binary_internals', []),45 cls.client.delete_job_binary_internal)46 cls.cleanup_resources(getattr(cls, '_data_sources', []),47 cls.client.delete_data_source)48 cls.clear_isolated_creds()49 super(BaseDataProcessingTest, cls).resource_cleanup()50 @staticmethod51 def cleanup_resources(resource_id_list, method):52 for resource_id in resource_id_list:53 try:54 method(resource_id)55 except exceptions.NotFound:56 # ignore errors while auto removing created resource57 pass58 @classmethod59 def create_node_group_template(cls, name, plugin_name, hadoop_version,60 node_processes, flavor_id,61 node_configs=None, **kwargs):62 """Creates watched node group template with specified params.63 It supports passing additional params using kwargs and returns created64 object. All resources created in this method will be automatically65 removed in tearDownClass method....

Full Screen

Full Screen

utils.py

Source:utils.py Github

copy

Full Screen

...51 assert execute_input['content']['code'] == code52 return msg_id, reply['content']53class AsyncKernelManagerSubclass(AsyncKernelManager):54 """Used to test deprecation "routes" that are determined by superclass' detection of methods.55 This class represents a current subclass that overrides both cleanup() and cleanup_resources()56 in order to be compatible with older jupyter_clients. We should find that cleanup_resources()57 is called on these instances vix TestAsyncKernelManagerSubclass.58 """59 def cleanup(self, connection_file=True):60 super().cleanup(connection_file=connection_file)61 self.which_cleanup = 'cleanup'62 def cleanup_resources(self, restart=False):63 super().cleanup_resources(restart=restart)64 self.which_cleanup = 'cleanup_resources'65class AsyncKernelManagerWithCleanup(AsyncKernelManager):66 """Used to test deprecation "routes" that are determined by superclass' detection of methods.67 This class represents the older subclass that overrides cleanup(). We should find that68 cleanup() is called on these instances via TestAsyncKernelManagerWithCleanup.69 """70 def cleanup(self, connection_file=True):71 super().cleanup(connection_file=connection_file)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful