Skip to content

Commit 3329fe2

Browse files
Use the existing wait_for from help_utils.
1 parent b2c4f32 commit 3329fe2

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

test/unit/test_profiler_runner.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import timedelta
2-
import time
32
from codeguru_profiler_agent.reporter.agent_configuration import AgentConfiguration
43
from test.pytestutils import before
4+
from test.help_utils import wait_for
55
from mock import MagicMock
66

77
from codeguru_profiler_agent.profiler_runner import ProfilerRunner
@@ -86,17 +86,7 @@ def test_when_orchestrator_says_no_to_profiler(self):
8686
# calling start in this test, it will start the scheduler and because initial delay is 0 it will execute now
8787
self.profiler_runner.start()
8888
# still it is safer to wait until the new config has been applied
89-
wait_until(lambda: AgentConfiguration.get().should_profile == False)
89+
wait_for(lambda: AgentConfiguration.get().should_profile is False)
9090

9191
assert self.profiler_runner.scheduler._get_next_delay_seconds() == 150
9292
self.mock_collector.add.assert_not_called()
93-
94-
95-
def wait_until(predicate, max_wait_seconds=1, period_seconds=0.1):
96-
start = time.time()
97-
timeout = start + max_wait_seconds
98-
while time.time() < timeout:
99-
if predicate():
100-
return True
101-
time.sleep(period_seconds)
102-
raise AssertionError("Predicate was never true after waiting for " + str(max_wait_seconds) + " seconds")

0 commit comments

Comments
 (0)