From edfab327c11f71edaa76fe61f9f62fe57407d96e Mon Sep 17 00:00:00 2001 From: George Petsagourakis Date: Sat, 19 Apr 2025 20:08:29 +0300 Subject: [PATCH 1/3] making tests run in vscode gui --- .vscode/settings.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..c35300696 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "python.testing.unittestArgs": [ + "--settings", + "dev_env.settings", + "--pattern", + "test_*.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true +} From f4684ab15eeecc2ddbc6bfe177409b9eef596dc5 Mon Sep 17 00:00:00 2001 From: George Petsagourakis Date: Sun, 20 Apr 2025 17:44:11 +0300 Subject: [PATCH 2/3] update launch configuration to use debugpy for Python debugging --- .vscode/launch.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index f03b4b177..0da00dfb4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "name": "DJL RunServer", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/manage.py", "args": [ From 35aeeaee225c1193c0cc009b7035f6724a07a7a5 Mon Sep 17 00:00:00 2001 From: petsagouris Date: Mon, 21 Apr 2025 10:22:24 +0300 Subject: [PATCH 3/3] Update launch configuration and README for testing in VS Code --- .vscode/launch.json | 10 ++++------ .vscode/settings.json | 3 ++- README.md | 8 ++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index f03b4b177..2708f71c0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,17 +3,15 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", - "configurations": [ + "configurations": [ { "name": "DJL RunServer", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/manage.py", - "args": [ - "runserver" - ], + "args": ["runserver"], "django": true, "justMyCode": true } ] -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index c35300696..82594303a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,6 @@ "test_*.py" ], "python.testing.pytestEnabled": false, - "python.testing.unittestEnabled": true + "python.testing.unittestEnabled": true, + "python.envFile": "${workspaceFolder}/dev_env/.env" } diff --git a/README.md b/README.md index eaf53a7c0..538151e07 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,14 @@ After setting up your development environment you may run tests. python manage.py test django_ledger ``` +## Running tests inside Visual Studio Core +If you want to run tests inside Visual Studio Core you will need to create an `.env` file inside `dev_env` with the following content: + +``` +MANAGE_PY_PATH=./manage.py +DJANGO_SETTINGS_MODULE=dev_env.settings +``` + # Screenshots ![django ledger entity dashboard](https://us-east-1.linodeobjects.com/django-ledger/public/img/django_ledger_entity_dashboard.png)