Best Python code snippet using locust
test_stats.py
Source:test_stats.py
...173 s.last_request_timestamp -= 1174 s.log(666, 1337)175 self.assertEqual(None, s.response_times_cache)176 177 def test_latest_total_response_times_pruned(self):178 """179 Check that RequestStats.latest_total_response_times are pruned when execeeding 20 entries180 """181 s = StatsEntry(self.stats, "/", "GET", use_response_times_cache=True)182 t = int(time.time())183 for i in reversed(range(2, 30)):184 s.response_times_cache[t-i] = CachedResponseTimes(response_times={}, num_requests=0)185 self.assertEqual(29, len(s.response_times_cache))186 s.log(17, 1337)187 s.last_request_timestamp -= 1188 s.log(1, 1)189 self.assertEqual(20, len(s.response_times_cache))190 self.assertEqual(191 CachedResponseTimes(response_times={17:1}, num_requests=1),...
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!!