Best Python code snippet using tempest_python
waiters.py
Source:waiters.py  
...516    caller = test_utils.find_test_caller()517    if caller:518        message = '(%s) %s' % (caller, message)519    raise lib_exc.TimeoutException(message)520def wait_for_object_create(object_client, container_name, object_name,521                           interval=1):522    """Waits for created object to become available"""523    start_time = time.time()524    while time.time() - start_time < object_client.build_timeout:525        try:526            return object_client.get_object(container_name, object_name)527        except lib_exc.NotFound:528            time.sleep(interval)529    message = ('Object %s failed to create within the required time (%s s).' %530               (object_name, object_client.build_timeout))...base.py
Source:base.py  
...100                cls.object_client.create_object(container_name,101                                                object_name,102                                                data,103                                                metadata=metadata)104                waiters.wait_for_object_create(cls.object_client,105                                               container_name,106                                               object_name)107                return object_name, data108            # after bucket creation we might see Conflict109            except lib_exc.Conflict as e:110                err = e111                time.sleep(2)112        raise err113    @classmethod114    def delete_containers(cls, container_client=None, object_client=None):115        if container_client is None:116            container_client = cls.container_client117        if object_client is None:118            object_client = cls.object_client...test_container_quotas.py
Source:test_container_quotas.py  
...74        """Attempts to upload many objects that exceeds the count limit."""75        for _ in range(QUOTA_COUNT):76            name = data_utils.rand_name(name="TestObject")77            self.object_client.create_object(self.container_name, name, "")78            waiters.wait_for_object_create(self.object_client,79                                           self.container_name,80                                           name)81        nbefore = self._get_object_count()82        self.assertEqual(nbefore, QUOTA_COUNT)83        self.assertRaises(lib_exc.OverLimit,84                          self.object_client.create_object,85                          self.container_name, "OverQuotaObject", "")86        nafter = self._get_object_count()87        self.assertEqual(nbefore, nafter)88    def _get_container_metadata(self):89        resp, _ = self.container_client.list_container_metadata(90            self.container_name)91        return resp92    def _get_object_count(self):...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
