diff --git a/.github/workflows/loristest.yml b/.github/workflows/loristest.yml index 1937f107b..5270813a8 100644 --- a/.github/workflows/loristest.yml +++ b/.github/workflows/loristest.yml @@ -33,7 +33,9 @@ jobs: - name: Override Test Files run: | cp test/Dockerfile.test.php8 Loris/ + cp test/Dockerfile.test.python Loris/ cp test/docker-compose.yml Loris/ + cp test/test_example.py Loris/test cp test/phpunit.xml Loris/test/ cp test/RB_SQL/* Loris/raisinbread/RB_files/ @@ -90,3 +92,9 @@ jobs: CI_NODE_TOTAL: ${{ matrix.ci_node_total }} # Use the index from matrix as an environment variable CI_NODE_INDEX: ${{ matrix.ci_node_index }} + + + - name: Build and run Docker Compose + run: | + cd Loris + docker compose run -T --rm pytest pytest diff --git a/test/Dockerfile.test.python b/test/Dockerfile.test.python new file mode 100644 index 000000000..c2af64563 --- /dev/null +++ b/test/Dockerfile.test.python @@ -0,0 +1,22 @@ +# Dockerfile +FROM python:3.11.3-slim + + +WORKDIR /app + +# Copy test files into the container +COPY . /app/test + +RUN echo "Working directory:" +RUN pwd +RUN echo "Directory contents:" +RUN ls -R +RUN cd test + + +# Install pytest +RUN pip install pytest + +# Set the default command to run tests +CMD ["pytest","/app/test"] + diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 55794465d..81c422e4f 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -1,5 +1,14 @@ -version: '2' +version: '3' services: + pytest: + build: + context: . + dockerfile: Dockerfile.test.python + volumes: + - ./:/app + working_dir: /app/test + command: pytest + db: build: context: . diff --git a/test/test_example.py b/test/test_example.py new file mode 100644 index 000000000..b2d513e5a --- /dev/null +++ b/test/test_example.py @@ -0,0 +1,7 @@ +# tests/test_example.py +def test_addition(): + assert 1 + 1 == 2 + +def test_subtraction(): + assert 2 - 1 == 1 +