Vorbereitung für PVL

main
Matias Mas Viehl 2025-12-14 13:21:55 +01:00
parent 4479a3339f
commit 828937930f
5 changed files with 31 additions and 43 deletions

View File

@ -6,6 +6,8 @@ ARG USERNAME=vscode
ARG USER_UID=1000 ARG USER_UID=1000
ARG USER_GID=$USER_UID 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 RUN groupadd --gid $USER_GID $USERNAME && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
USER $USERNAME USER $USERNAME
WORKDIR /workspace WORKDIR /workspace

View File

@ -1,19 +1,31 @@
{ {
"name": "Python 3.11 Dev Container", "name": "Python 3.11 Dev Container",
"dockerFile": "Dockerfile", "image": "dev-test-image:latest",
"mounts": [ //"dockerFile": "Dockerfile",
"source=${localWorkspaceFolder},target=/workspace,type=bind" "mounts": [
], "source=${localWorkspaceFolder},target=/workspace,type=bind"
"settings": { ],
"python.linting.enabled": true, "remoteUser": "vscode",
"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", "customizations": {
"remoteUser": "vscode" "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"
} }

View File

@ -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)