diff --git a/.github/workflows/loristest.yml b/.github/workflows/loristest.yml index 1937f107b..95a07a38c 100644 --- a/.github/workflows/loristest.yml +++ b/.github/workflows/loristest.yml @@ -1,4 +1,4 @@ -name: LORIS Test Suite +name: LORIS-MRI Test Suite on: - push @@ -26,17 +26,24 @@ jobs: php-version: ${{ matrix.php }} extensions: zip, php-ast - - name: Clone Loris repo run: git clone https://github.com/aces/Loris.git - name: Override Test Files run: | cp test/Dockerfile.test.php8 Loris/ + cp test/Dockerfile.test.py Loris/ cp test/docker-compose.yml Loris/ cp test/phpunit.xml Loris/test/ cp test/RB_SQL/* Loris/raisinbread/RB_files/ + - name: List directory contents + run: ls -la + + - name: Build LORIS-MRI-PYTEST + run: | + docker compose -f test/docker-compose.yml up --build --exit-code-from pytest + - name: Validate composer.json and composer.lock run: | cd Loris @@ -78,15 +85,3 @@ jobs: cd Loris make dev - - name: Run Test Suite - run: | - # set sandbox to 1 before running the tests - # since some tests only run in sandbox environments - sed -i 's/0<\/sandbox>/1<\/sandbox>/g' Loris/test/config.xml - cd Loris - npm run tests:${{ matrix.testsuite }} - env: - # Specifies how many jobs you would like to run in parallel, - CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - # Use the index from matrix as an environment variable - CI_NODE_INDEX: ${{ matrix.ci_node_index }} diff --git a/test/Dockerfile.test.py b/test/Dockerfile.test.py new file mode 100644 index 000000000..5d5e686a4 --- /dev/null +++ b/test/Dockerfile.test.py @@ -0,0 +1,10 @@ +# Dockerfile +FROM python:3.11.3-slim + +WORKDIR /app + +COPY test/hello-world-pytest /app/test/hello-world-pytest + +RUN pip install pytest + +CMD ["pytest","/app/test/hello-world-pytest"] diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 55794465d..2cf5f0e9b 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -1,5 +1,11 @@ -version: '2' +version: '3' services: + pytest: + build: + context: . + dockerfile: Dockerfile.test.py + command: pytest /app/test/hello-world-pytest + db: build: context: . diff --git a/test/hello-world-pytest/hello.py b/test/hello-world-pytest/hello.py new file mode 100644 index 000000000..2f11d4218 --- /dev/null +++ b/test/hello-world-pytest/hello.py @@ -0,0 +1,3 @@ +# hello.py +def say_hello(): + return "Hello, World!" diff --git a/test/hello-world-pytest/test_hello.py b/test/hello-world-pytest/test_hello.py new file mode 100644 index 000000000..bb01ab738 --- /dev/null +++ b/test/hello-world-pytest/test_hello.py @@ -0,0 +1,5 @@ +# test_hello.py +from hello import say_hello + +def test_say_hello(): + assert say_hello() == "Hello, World!"