diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..80f55a9 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,38 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Debug Tests", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "purpose": [ + "debug-test" + ], + "console": "integratedTerminal", + "justMyCode": false, + "env": { + "PYTEST_ADDOPTS": "--no-cov" + } + }, + { + "name": "Python: Current File", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + }, + { + "name": "Python: API Server", + "type": "debugpy", + "request": "launch", + "module": "alpine_bits_python.run_api", + "console": "integratedTerminal", + "justMyCode": true, + "env": { + "ALPINEBITS_CONFIG_DIR": "${workspaceFolder}/config" + } + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 35d9ae1..6d1f9e5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,17 @@ "notebook.output.wordWrap": true, "notebook.output.textLineLimit": 200, "jupyter.debugJustMyCode": false, + "python.defaultInterpreterPath": "./.venv/bin/python", "python.testing.pytestEnabled": true, + "python.testing.pytestArgs": [ + "tests", + "-v", + "--tb=short" + ], + "python.testing.pytestPath": "./.venv/bin/pytest", + "python.testing.unittestEnabled": false, + "python.testing.autoTestDiscoverOnSaveEnabled": true, + "python.testing.cwd": "${workspaceFolder}", "files.exclude": { "**/*.egg-info": true, "**/htmlcov": true, @@ -27,27 +37,6 @@ "**/.venv": true, "**/__pycache__": true, "**/.mypy_cache": true, - "**/.pytest_cache": true, + "**/.pytest_cache": true } -} - -// .vscode/launch.json -{ - "version": "0.2.0", - "configurations": [ - { - "name": "Python: Debug Tests", - "type": "debugpy", - "request": "launch", - "program": "${file}", - "purpose": [ - "debug-test" - ], - "console": "integratedTerminal", - "justMyCode": false, - "env": { - "PYTEST_ADDOPTS": "--no-cov" - } - } - ] } \ No newline at end of file diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..81266b7 --- /dev/null +++ b/conftest.py @@ -0,0 +1,13 @@ +"""Pytest configuration and path setup for VS Code. + +This configuration file ensures that VS Code can properly discover and run tests +by setting up the Python path to include the src directory. +""" + +import sys +from pathlib import Path + +# Add the src directory to Python path for VS Code test discovery +src_path = Path(__file__).parent / "src" +if str(src_path) not in sys.path: + sys.path.insert(0, str(src_path))