From 9a71cf7ff882618e61703b5a69f9425fcce9a01f Mon Sep 17 00:00:00 2001 From: Dylan Huang Date: Sat, 2 Aug 2025 09:42:33 -0700 Subject: [PATCH] configure stdout for pytest debugging --- .vscode/launch.json | 39 +++++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 14 ++++++-------- pytest.ini | 4 ++++ 3 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..828a253f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,39 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Debug Tests", + "type": "python", + "request": "launch", + "module": "pytest", + "args": ["-s", "--tb=short", "${file}"], + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "PYTHONPATH": "${workspaceFolder}" + } + }, + { + "name": "Python: Debug Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "PYTHONPATH": "${workspaceFolder}" + } + }, + { + "name": "Python: Debug Module", + "type": "python", + "request": "launch", + "module": "eval_protocol", + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "PYTHONPATH": "${workspaceFolder}" + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 161ff303..f7f61b72 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,10 +1,8 @@ { - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, - "python.testing.pytestArgs": [ - "tests", - "examples" - ], - "python.testing.autoTestDiscoverOnSaveEnabled": true, - "python.defaultInterpreterPath": "./.venv/bin/python" + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "python.testing.pytestArgs": ["tests", "examples", "-s", "--tb=short"], + "python.testing.autoTestDiscoverOnSaveEnabled": true, + "python.defaultInterpreterPath": "./.venv/bin/python", + "python.testing.cwd": "${workspaceFolder}" } diff --git a/pytest.ini b/pytest.ini index f7dc44ab..785d4d7e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,6 +7,10 @@ testpaths = tests python_files = test_*.py python_classes = Test* python_functions = test_* +# Configure stdout/stderr capture for debugging +addopts = -s --tb=short +# Alternative: disable capture completely for debugging +# addopts = -s --tb=short --capture=no filterwarnings = ignore::UserWarning:pydantic.* ignore::DeprecationWarning:pydantic.*