|
20 | 20 | from rich.panel import Panel |
21 | 21 |
|
22 | 22 | _HTTP_LOGGING_SETUP_CODE: Final[str] = """ |
23 | | -# Injected by test runner to enable HTTP request logging |
24 | | -import http.client |
25 | | -http.client.HTTPConnection.debuglevel = 1 |
26 | | -
|
27 | | -import logging |
28 | | -logging.getLogger("osparc").setLevel(logging.DEBUG) |
| 23 | +# Injected by test runner: force debug=True on every osparc_client Configuration |
| 24 | +import osparc_client |
| 25 | +_orig_init = osparc_client.Configuration.__init__ |
| 26 | +def _init_with_debug(self, *a, **kw): |
| 27 | + _orig_init(self, *a, **kw) |
| 28 | + self.debug = True |
| 29 | +osparc_client.Configuration.__init__ = _init_with_debug |
29 | 30 | """ |
30 | 31 |
|
31 | 32 | _NOTEBOOK_EXECUTION_TIMEOUT_SECONDS: Final[int] = 60 * 20 # 20min |
@@ -54,7 +55,10 @@ def _pretty_print_cell_outputs(notebook_path: Path) -> None: |
54 | 55 |
|
55 | 56 |
|
56 | 57 | def _inject_http_logging_setup_cell(notebook_path: Path) -> None: |
57 | | - # Inject HTTP logging setup cell at the beginning of the notebook to ensure osparc http request data is logged (mainly to log trace ids for easier debugging of test failures) |
| 58 | + # Inject HTTP logging setup cell at the beginning of the notebook to ensure |
| 59 | + # osparc http request data is logged (mainly to log trace ids for easier |
| 60 | + # debugging of test failures). Uses a spy on osparc_client.rest to print |
| 61 | + # response headers for every HTTP request. |
58 | 62 | nb = nbformat.read(notebook_path, as_version=4) |
59 | 63 | setup_cell = nbformat.v4.new_code_cell(source=_HTTP_LOGGING_SETUP_CODE) |
60 | 64 | nb.cells.insert(0, setup_cell) |
|
0 commit comments