Update Dockerfile and add comments in pyproject.toml

This commit is contained in:
2025-01-23 18:39:47 +01:00
parent 62b200d131
commit bf5c08346e
4 changed files with 51 additions and 49 deletions

27
tests/test_dockerfile.py Normal file
View File

@ -0,0 +1,27 @@
from __future__ import annotations
from pathlib import Path
import pytest
@pytest.fixture
def dockerfile_content() -> str:
"""Read the content of the Dockerfile and return it as a string.
Returns:
str: The content of the Dockerfile.
"""
return Path("Dockerfile").read_text(encoding="utf-8")
def test_volume_exists(dockerfile_content: str) -> None:
"""Test that the volume is set in the Dockerfile."""
assert_msg = "Volume not set in Dockerfile. This has to always be set to /home/botuser/data/."
assert 'VOLUME ["/home/botuser/data/"]' in dockerfile_content, assert_msg
def test_env_variables(dockerfile_content: str) -> None:
"""Test that the environment variables for Python are set in the Dockerfile."""
assert "ENV PYTHONUNBUFFERED=1" in dockerfile_content, "PYTHONUNBUFFERED not set in Dockerfile"
assert "ENV PYTHONDONTWRITEBYTECODE=1" in dockerfile_content, "PYTHONDONTWRITEBYTECODE not set in Dockerfile"