testplan.runnable.interactive package¶
Submodules¶
testplan.runnable.interactive.base¶
Interactive handler for TestRunner runnable class.
-
class
testplan.runnable.interactive.base.
TestRunnerIHandler
(target, startup_timeout=10, http_port=0, pre_start_environments=None)[source]¶ Bases:
testplan.common.entity.base.Entity
Runnable interactive handler for
TestRunner
runnable object.-
CONFIG
¶ alias of
TestRunnerIHandlerConfig
-
STATUS
¶
-
environment_resource_context
(env_uid, resource_uid, context_item=None, **kwargs)[source]¶ Get the context info of an environment resource.
-
environment_resource_operation
(env_uid, resource_uid, res_op, **kwargs)[source]¶ Perform an operation on an environment resource.
-
exit_code
¶ Code to indicate success or failure.
-
exporters
¶
-
get_environment_context
(env_uid, resource_uid=None, exclude_callables=True, exclude_protected=True, exclude_private=True)[source]¶ Get the context information of an environment.
-
http_handler_info
¶
-
report
¶ A handle to access the report via recursive parent
-
reset_all_tests
(await_results=True)[source]¶ Reset the Testplan report.
Parameters: await_results – Whether to block until tests are finished, defaults to True. Returns: If await_results is True, returns a testplan report. Otherwise, returns a future which will yield a testplan report when ready.
-
reset_test
(test_uid, await_results=True)[source]¶ Reset the report of a single Test instance.
Parameters: - test_uid – UID of test to reset.
- await_results – Whether to block until tests are finished, defaults to True.
Returns: If await_results is True, returns a testplan report. Otherwise, returns a future which will yield a testplan report when ready.
-
run_all_tests
(shallow_report: Optional[Dict[KT, VT]] = None, await_results: bool = True) → Union[testplan.report.testing.base.TestReport, Awaitable[T_co]][source]¶ Runs all tests.
Parameters: - shallow_report – shallow report entry, optional
- await_results – Whether to block until tests are finished, defaults to True.
Returns: If await_results is True, returns a testplan report. Otherwise, returns a future which will yield a testplan report when ready.
-
run_test
(test_uid: str, shallow_report: Optional[Dict[KT, VT]] = None, await_results: bool = True) → Union[testplan.report.testing.base.TestReport, Awaitable[T_co]][source]¶ Run a single Test instance.
Parameters: - test_uid – UID of test to run.
- shallow_report – shallow report entry, optional
- await_results – Whether to block until the test is finished, defaults to True.
Returns: If await_results is True, returns a test report. Otherwise, returns a future which will yield a test report when ready.
-
run_test_case
(test_uid: str, suite_uid: str, case_uid: str, shallow_report: Optional[Dict[KT, VT]] = None, await_results: bool = True) → Union[testplan.report.testing.base.TestReport, Awaitable[T_co]][source]¶ Run a single testcase.
Parameters: - test_uid – UID of the test that owns the testcase.
- suite_uid – UID of the suite that owns the testcase.
- case_uid – UID of the testcase to run.
- shallow_report – shallow report entry, optional
- await_results – Whether to block until the testcase is finished, defaults to True.
Returns: If await_results is True, returns a testcase report. Otherwise, returns a future which will yield a testcase report when ready.
-
run_test_case_param
(test_uid: str, suite_uid: str, case_uid: str, param_uid: str, shallow_report: Optional[Dict[KT, VT]] = None, await_results: bool = True)[source]¶ Run a single parametrization of a testcase.
Parameters: - test_uid – UID of the test that owns the testcase.
- suite_uid – UID of the suite that owns the testcase.
- case_uid – UID of the testcase to run.
- param_uid – UID of the parametrization to run.
- shallow_report – shallow report entry, optional
- await_results – Whether to block until the testcase is finished, defaults to True.
Returns: If await_results is True, returns a testcase report. Otherwise, returns a future which will yield a testcase report when ready.
-
run_test_suite
(test_uid: str, suite_uid: str, shallow_report: Optional[Dict[KT, VT]] = None, await_results: bool = True) → Union[testplan.report.testing.base.TestReport, Awaitable[T_co]][source]¶ Run a single test suite.
Parameters: - test_uid – UID of the test that owns the suite.
- suite_uid – UID of the suite to run.
- shallow_report – shallow report entry, optional
- await_results – Whether to block until the suite is finished, defaults to True.
Returns: If await_results is True, returns a testsuite report. Otherwise, returns a future which will yield a testsuite report when ready.
-
start_test_resources
(test_uid, await_results=True)[source]¶ Start all test resources.
Parameters: - test_uid – UID of test to start resources for
- await_results – Whether to block until the test resources have all started, defaults to True.
Returns: If await_results is True, returns a list of the return values of each resource start operation, otherwise returns a list of async result objects.
-
stop_test_resources
(test_uid, await_results=True)[source]¶ Stop all test resources.
Parameters: - test_uid – UID of test to stop resources for
- await_results – Whether to block until the test resources have all stopped, defaults to True.
Returns: If await_results is True, returns a list of the return values of each resource stop operation, otherwise returns a list of async result objects.
-
target
¶ The test runner instance.
-
test
(test_uid)[source]¶ Get a test instance with the specified UID.
Parameters: test_uid – UID of test to find.
-
-
class
testplan.runnable.interactive.base.
TestRunnerIHandlerConfig
(**options)[source]¶ Bases:
testplan.common.config.base.Config
Configuration object for
TestRunnerIHandler
runnable interactive handler.
testplan.runnable.interactive.http¶
Http handler for interactive mode.
-
class
testplan.runnable.interactive.http.
TestRunnerHTTPHandler
(**options)[source]¶ Bases:
testplan.common.entity.base.Entity
Server that invokes an interactive handler to perform dynamic operations.
Parameters: - ihandler (
Entity
) – Runnable interactive handler instance. - host (
str
) – Host to bind to. - port (
int
) – Port to bind to.
Also inherits all
Entity
options.-
CONFIG
¶ alias of
TestRunnerHTTPHandlerConfig
-
bind_addr
¶ Returns: Bound host and port of HTTP server, or None if not bound. Return type: Optional[Tuple[str, int]]
- ihandler (
-
class
testplan.runnable.interactive.http.
TestRunnerHTTPHandlerConfig
(**options)[source]¶ Bases:
testplan.common.entity.base.EntityConfig
Configuration object for
TestRunnerHTTPHandler
entity.
testplan.runnable.interactive.reloader¶
Interactive code reloader module.
-
class
testplan.runnable.interactive.reloader.
ModuleReloader
(extra_deps=None, scheduled_modules=None)[source]¶ Bases:
testplan.common.utils.logger.Loggable
Reloads modules and their dependencies if there was any file modification.
Parameters: - extra_deps (
Iterable[ModuleType]
orIterable[str]
) – Modules to register as extra dependencies to reload, despite not being directly imported by __main__, or paths of these modules. - scheduled_modules (
Dict[str, str]
) – Name of module which has schedule tests, with the module path registered as extra dependencies to reload.
- extra_deps (