From 873d3601e0c4a5ca128799f8b6514a1816b735e1 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 1 May 2023 16:50:57 -0400 Subject: [PATCH] Tests: convert more left-over type hint to type comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use type comments to support older python3 interpreters that can't handle type hints (such as 3.4). Change-Id: I3599311dfcc172344c759f8c0e22af640759f1f5 Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- .../ust/ust-constructor/test_ust_constructor.py | 2 +- tests/utils/lttngtest/environment.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/regression/ust/ust-constructor/test_ust_constructor.py b/tests/regression/ust/ust-constructor/test_ust_constructor.py index 1682071e2..06939742e 100755 --- a/tests/regression/ust/ust-constructor/test_ust_constructor.py +++ b/tests/regression/ust/ust-constructor/test_ust_constructor.py @@ -196,7 +196,7 @@ def capture_trace(tap, test_env): return session_output_location -def validate_trace(trace_location, tap) -> bool: +def validate_trace(trace_location, tap): # type: (pathlib.Path, lttngtest.TapGenerator) -> bool success = True unknown_event_count = 0 diff --git a/tests/utils/lttngtest/environment.py b/tests/utils/lttngtest/environment.py index 282e95643..0efb2b5f5 100644 --- a/tests/utils/lttngtest/environment.py +++ b/tests/utils/lttngtest/environment.py @@ -192,8 +192,9 @@ class TraceTestApplication: Create an application to trace. """ - def __init__(self, binary_path: pathlib.Path, environment: "Environment"): - self._environment: Environment = environment + def __init__(self, binary_path, environment): + # type: (pathlib.Path, Environment) + self._environment = environment # type: Environment self._has_returned = False test_app_env = os.environ.copy() @@ -208,7 +209,8 @@ class TraceTestApplication: test_app_args, env=test_app_env ) - def wait_for_exit(self) -> None: + def wait_for_exit(self): + # type: () -> None if self._process.wait() != 0: raise RuntimeError( "Test application has exit with return code `{return_code}`".format( @@ -412,9 +414,8 @@ class _Environment(logger._Logger): self, ) - def launch_trace_test_constructor_application( - self - ) -> TraceTestApplication: + def launch_trace_test_constructor_application(self): + # type () -> TraceTestApplication """ Launch an application that will trace from within constructors. """ -- 2.34.1