From 9b2d808f0429e6210784710757fb98159996e018 Mon Sep 17 00:00:00 2001 From: "jj-author@users.noreply.github.com" Date: Fri, 25 Oct 2024 13:01:21 +0200 Subject: [PATCH] added some initial configs and settings to run pytests in vscode --- .vscode/launch.json | 14 ++++++++++++- .vscode/settings.json | 7 +++++++ .vscode/tasks.json | 49 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/launch.json b/.vscode/launch.json index e26aa91..9740696 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,7 +3,7 @@ { "type": "debugpy", "request": "launch", - "name": "Launch Custom Proxy (manual virtual env selection)", + "name": "Run Time-Machine (manual virtual env selection)", "program": "${workspaceFolder}/ontologytimemachine/custom_proxy.py", "args": [ "--ontoFormat","ntriples", @@ -15,6 +15,18 @@ "--port","8877" ] }, + { + "name": "Run pytest module (manual virtual env selection)", + "type": "debugpy", + "request": "launch", + "cwd": "${workspaceFolder}", + "module": "pytest", + "args": [ + ], + "console": "integratedTerminal", + // "preLaunchTask":"Wait for Poetry Run Time-Machine-Proxy", + "justMyCode": true, + }, { //untested "type": "debugpy", "request": "launch", diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9b38853 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a9399d3..48d4300 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -10,6 +10,55 @@ "kind": "build", "isDefault": true } + }, + { + "label": "Wait for Poetry Run Time-Machine-Proxy", + "type": "shell", + "command": "poetry run python ontologytimemachine/custom_proxy.py", + "isBackground": true, // Runs the task in the background so VS Code can proceed to other tasks. + "problemMatcher": { + "pattern": [ + { + "regexp": ".", // Matches any output line. Used to capture log lines for monitoring task progress. + "file": 1, // Placeholder; not capturing a specific file path here. + "location": 2, // Placeholder; not capturing specific location info (line/column). + "message": 3 // Placeholder; not capturing specific error messages. + } + ], + "background": { + // "activeOnStart": true, // Marks the task as active immediately upon starting. + "beginsPattern": ".*Starting.*", // Detects the start of the task by matching "Starting proxy" in logs. + "endsPattern": ".*Loaded plugin __main__.OntologyTimeMachinePlugin.*" // Marks task readiness by matching "Loaded plugin" in logs. + } + }, + "group": { + "kind": "test", // Groups the task as a test so it won’t interfere with build tasks. + "isDefault": false + }, + "options": { + "shell": { + "executable": "/usr/bin/sh", + "args": [ + "-c" + ] + } + }, + // "presentation": { + // "reveal": "never", // Hides the task’s terminal output + // "close": true // Closes the task automatically when tests complete + // } + }, + { + "label": "Sleep for Time-Machine-Proxy startup", + "type": "shell", + "command": "sleep 5", // Adjust delay as needed + "dependsOn": [ + "Poetry Run Time-Machine-Proxy" + ], + "group": { + "kind": "test", + "isDefault": false + } } ] } \ No newline at end of file