Skip to content

Commit

Permalink
make the plan wait properly for interactive start (#1019)
Browse files Browse the repository at this point in the history
moved the helper to a place from where it can be used in
the executable as well as in the testcases.

Co-authored-by: Krisztian Notaisz <[email protected]>
  • Loading branch information
kn-ms and kn-ms authored Nov 10, 2023
1 parent a44b9b2 commit b679529
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
13 changes: 0 additions & 13 deletions tests/functional/testplan/runnable/interactive/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@
from testplan.common.utils.timing import wait


def interactive_started(plan):
return plan.interactive.http_handler_info[0] is not None


def wait_for_interactive_start(plan):
wait(
lambda: interactive_started(plan),
5,
raise_on_timeout=True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from testplan import TestplanMock
from testplan.testing.multitest import MultiTest
from testplan.common.utils.comparison import compare
from interactive_helper import wait_for_interactive_start

THIS_DIRECTORY = os.path.dirname(os.path.abspath(__file__))

Expand Down Expand Up @@ -435,6 +436,7 @@ def main():
kwargs=dict(name="ScheduledTest2"),
)
plan.run()
wait_for_interactive_start(plan)

# Run tests
plan.interactive.run_all_tests()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from testplan.common.utils.timing import wait


def interactive_started(plan):
return plan.interactive.http_handler_info[0] is not None


def wait_for_interactive_start(plan):
wait(
lambda: interactive_started(plan),
5,
raise_on_timeout=True,
)
2 changes: 1 addition & 1 deletion tests/functional/testplan/runnable/interactive/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from testplan.report import Status, RuntimeStatus
from testplan.testing import multitest
from testplan.testing.multitest import driver
from tests.functional.testplan.runnable.interactive import (
from tests.functional.testplan.runnable.interactive.interactive_helper import (
wait_for_interactive_start,
)
from tests.unit.testplan.runnable.interactive import test_api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from testplan.environment import LocalEnvironment
from testplan.testing.multitest import MultiTest, testcase, testsuite
from testplan.testing.multitest.driver.tcp import TCPClient, TCPServer
from tests.functional.testplan.runnable.interactive import (
from tests.functional.testplan.runnable.interactive.interactive_helper import (
wait_for_interactive_start,
)

Expand Down

0 comments on commit b679529

Please sign in to comment.