diff --git a/python/.devcontainer/Dockerfile b/python/.devcontainer/Dockerfile index 7cf707e..eff9cf2 100644 --- a/python/.devcontainer/Dockerfile +++ b/python/.devcontainer/Dockerfile @@ -6,6 +6,8 @@ ARG USERNAME=vscode ARG USER_UID=1000 ARG USER_GID=$USER_UID +RUN pip install --no-cache-dir pytest black + RUN groupadd --gid $USER_GID $USERNAME && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME USER $USERNAME WORKDIR /workspace diff --git a/python/.devcontainer/devcontainer.json b/python/.devcontainer/devcontainer.json index ec8d953..5b115e6 100644 --- a/python/.devcontainer/devcontainer.json +++ b/python/.devcontainer/devcontainer.json @@ -1,19 +1,31 @@ { - "name": "Python 3.11 Dev Container", - "dockerFile": "Dockerfile", - "mounts": [ - "source=${localWorkspaceFolder},target=/workspace,type=bind" - ], - "settings": { - "python.linting.enabled": true, - "python.linting.pylintEnabled": true, - "python.formatting.provider": "black" - }, - "extensions": [ - "ms-python.python", - "ms-python.vscode-pylance" - ], - - "postCreateCommand": "pip install --upgrade pip && pip install pytest black", - "remoteUser": "vscode" + "name": "Python 3.11 Dev Container", + "image": "dev-test-image:latest", + //"dockerFile": "Dockerfile", + "mounts": [ + "source=${localWorkspaceFolder},target=/workspace,type=bind" + ], + "remoteUser": "vscode", + + "customizations": { + "vscode": { + "settings": { + // Testing: Pytest-Erkennung aktivieren + "python.testing.pytestEnabled": true, + "python.testing.pytestArgs": [ + "." + ], + + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.provider": "black" + }, + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance" + ] + } + }, + + "postCreateCommand": "pip install --upgrade pip" } \ No newline at end of file diff --git a/python/01_python_tooling/__pycache__/sum_calculator.cpython-311.pyc b/python/01_python_tooling/__pycache__/sum_calculator.cpython-311.pyc new file mode 100644 index 0000000..ced54c8 Binary files /dev/null and b/python/01_python_tooling/__pycache__/sum_calculator.cpython-311.pyc differ diff --git a/python/01_python_tooling/__pycache__/test_sum_calculator.cpython-311-pytest-9.0.2.pyc b/python/01_python_tooling/__pycache__/test_sum_calculator.cpython-311-pytest-9.0.2.pyc new file mode 100644 index 0000000..e12db6b Binary files /dev/null and b/python/01_python_tooling/__pycache__/test_sum_calculator.cpython-311-pytest-9.0.2.pyc differ diff --git a/python/01_python_tooling/test_sum_calculator.py b/python/01_python_tooling/test_sum_calculator.py deleted file mode 100644 index 3d06087..0000000 --- a/python/01_python_tooling/test_sum_calculator.py +++ /dev/null @@ -1,26 +0,0 @@ -# Datei: test_sum_calculator.py - -from sum_calculator import calculate_cumulative_sum - -def test_sum_for_zero(): - """Testet den Randfall, wenn die Obergrenze 0 ist.""" - # Arrange: Testdaten - limit = 0 - # Act: Funktion aufrufen - result = calculate_cumulative_sum(limit) - # Assert: Überprüfen des Ergebnisses (0 erwartet) - assert result == 0 - -def test_sum_for_five(): - """Testet den allgemeinen Fall für die Zahl 5 (0+1+2+3+4+5 = 15).""" - # Arrange: Testdaten - limit = 5 - # Act: Funktion aufrufen - result = calculate_cumulative_sum(limit) - # Assert: Überprüfen des Ergebnisses (15 erwartet) - assert result == 15 - -def test_sum_is_correct_type(): - """Testet, ob die Funktion einen Integer zurückgibt.""" - # Arrange, Act, Assert - assert isinstance(calculate_cumulative_sum(3), int) \ No newline at end of file