tests: add typing annotations to lttng_live_server.py
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 18 Sep 2023 19:07:30 +0000 (15:07 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 20 Oct 2023 23:29:14 +0000 (19:29 -0400)
commitaca7de769c495565a693605d1f372f1b477cdb70
tree41873bde9c21cbd0405752211f5dc9e2606dcd32
parentf3760aea83e0c7593f89510c25424723f31b804a
tests: add typing annotations to lttng_live_server.py

Add typing annotations throughout lttng_live_server.py, such that
pyright passes cleanly in strict mode.

Specify in a comment in lttng_live_server.py to run in strict mode, but
disable these two warnings:

 - reportTypeCommentUsage: we need to use the comment form to support
   Python 3.4
 - reportMissingTypeStubs: it would complain about not having a stub
   file for the utils module (although it can inspect utils.py just
   fine)

Note that the sessions_filename variable near the bottom is marked as a
string, even though it's currently an optional argument (so it should be
`str | None`).  But the rest of the code treats it as non-optional.
This is corrected in a subsequent patch that makes the sessions filename
mandatory.

Change the way lttng_live_server.py is launched to use run_python, to
have access to Python modules in tests/utils/python, to have access to
jsonw.py and possible the typing module shim for Python 3.4.

Change-Id: I842f4c696eea7c99932876af26c195bf99d5cfff
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10869
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py
tests/plugins/src.ctf.lttng-live/test_live
This page took 0.024557 seconds and 4 git commands to generate.