I see this very often when running tests locally:
___________________________ TestLocustRunner.test_cpu_warning ___________________________
self = <locust.test.test_runners.TestLocustRunner testMethod=test_cpu_warning>
def test_cpu_warning(self):
_monitor_interval = runners.CPU_MONITOR_INTERVAL
runners.CPU_MONITOR_INTERVAL = 2.0
try:
class CpuUser(User):
wait_time = constant(0.001)
@task
def cpu_task(self):
for i in range(1000000):
_ = 3 / 2
environment = Environment(user_classes=[CpuUser])
runner = LocalRunner(environment)
self.assertFalse(runner.cpu_warning_emitted)
runner.spawn_users(1, 1, wait=False)
sleep(2.5)
runner.quit()
> self.assertTrue(runner.cpu_warning_emitted)
E AssertionError: False is not true
test/test_runners.py:121: AssertionError
I havent seen that flakyness, neither on my machine (MacOS) or on the Travis runs. Have you tried anything to make it less flaky?
Perhaps the issue is the monitor interval being too long? Try dropping it to 1.0.
Hmmm. Let me test some more and I'll update.
OK I've worked it out: when my Macbook CPU is high the test fails.
I guess that's my problem 😅
Most helpful comment
OK I've worked it out: when my Macbook CPU is high the test fails.
I guess that's my problem 😅