Repository: pyccel/pyccel (language: python)

Issue:
Cuda coverage tests don't work
The coverage tests report using an absolute path. As the cuda tests use a docker (and a different python version) compared to the linux tests the source folder is different for these two cases. Therefore when they are combined (with the source explicitly specified) the cuda results are ignored. Coverage has a `relative_path` flag which is designed to handle problems where coverage is tested in different environments (exactly our problem). The use of this flag should fix the problem.

*as seen in #1266*


Discussion / hints:

Fix patch:
diff --git a/MANIFEST.in b/MANIFEST.in
index 656cdd153a..bf873bea31 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,6 +6,7 @@ include README.md
 recursive-include pyccel *.tx
 recursive-include pyccel *.pyh
 recursive-include pyccel *.c
+recursive-include pyccel *.cu
 recursive-include pyccel *.f90
 recursive-include pyccel *.h
 recursive-include pyccel *.pyccel
diff --git a/pyproject.toml b/pyproject.toml
index 9f6ed0ea68..1f6c6657d8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,10 +1,11 @@
 [build-system]
 requires = [
     "setuptools >= 37, < 61",
+    "wheel",
     "numpy >= 1.16",
-    "sympy>=1.2",
+    "sympy >= 1.2",
     "termcolor >= 1.0.0",
-    "textx>=2.2",
+    "textx >= 2.2",
     "filelock >= 3.4.0",
 ]
 build-backend = "setuptools.build_meta"
diff --git a/setup.cfg b/setup.cfg
index 1fbf13e34c..89c57c51e2 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -27,6 +27,7 @@ test =
     pytest >= 2.7
     scipy >= 1.5.0
     mpi4py >= 3.0.0
+    tblib >= 1.7.0
     coverage >= 3.1
     astunparse >= 1.6.0
     pytest-xdist >= 1.16


Test patch:
diff --git a/.github/actions/pytest_run_cuda/action.yml b/.github/actions/pytest_run_cuda/action.yml
index 7ab1a8eabc..8f82dda10f 100644
--- a/.github/actions/pytest_run_cuda/action.yml
+++ b/.github/actions/pytest_run_cuda/action.yml
@@ -10,7 +10,7 @@ runs:
   steps:
     - name: Ccuda tests with pytest
       run: |
-        python -m pytest -n auto -rx -m "not (parallel or xdist_incompatible) and ccuda" --ignore=tests/symbolic --ignore=tests/ndarrays
+        python -m pytest -n auto -rx -m "not (parallel or xdist_incompatible) and ccuda" --ignore=symbolic --ignore=ndarrays
         pyccel-clean
       shell: ${{ inputs.shell_cmd }}
-      working-directory: ./
+      working-directory: ./tests
diff --git a/.github/workflows/Github_pytest.yml b/.github/workflows/Github_pytest.yml
index 50280f1a56..49b69e1a2f 100644
--- a/.github/workflows/Github_pytest.yml
+++ b/.github/workflows/Github_pytest.yml
@@ -17,8 +17,11 @@ jobs:
           python-version: 3.7
       - name: Install dependencies
         uses: ./.github/actions/linux_install
-      - name: Install python dependencies
-        uses: ./.github/actions/pip_installation
+      - name: Install Pyccel with tests
+        run: |
+            python -m pip install --upgrade pip
+            python -m pip install .[test]
+        shell: bash
       - name: Coverage install
         uses: ./.github/actions/coverage_install
       - name: Fortran/C tests with pytest
@@ -59,8 +62,11 @@ jobs:
       #  uses: msys2/setup-msys2@v2
       - name: Install dependencies
         uses: ./.github/actions/windows_install
-      - name: Install python dependencies
-        uses: ./.github/actions/pip_installation
+      - name: Install Pyccel with tests
+        run: |
+            python -m pip install --upgrade pip
+            python -m pip install .[test]
+        shell: bash
       - name: Fortran/C tests with pytest
         uses: ./.github/actions/pytest_run
       - name: Python tests with pytest
@@ -80,8 +86,11 @@ jobs:
           python-version: '3.10'
       - name: Install dependencies
         uses: ./.github/actions/macos_install
-      - name: Install python dependencies
-        uses: ./.github/actions/pip_installation
+      - name: Install Pyccel with tests
+        run: |
+            python -m pip install --upgrade pip
+            python -m pip install .[test]
+        shell: bash
       - name: Fortran/C tests with pytest
         uses: ./.github/actions/pytest_run
       - name: Python tests with pytest
@@ -95,7 +104,7 @@ jobs:
     container: nvidia/cuda:11.7.1-devel-ubuntu20.04
     if: github.event.pull_request.base.ref != 'master'
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
       - name: Prepare docker
         run: |
           apt update && apt install sudo
@@ -107,8 +116,13 @@ jobs:
         run: nvcc --version # cuda install check
       - name: Install dependencies
         uses: ./.github/actions/linux_install
-      - name: Install python dependencies
-        uses: ./.github/actions/pip_installation
+      - name: Install Pyccel with tests
+        run: |
+            PATH=${PATH}:$HOME/.local/bin
+            echo "PATH=${PATH}" >> $GITHUB_ENV
+            python -m pip install --upgrade pip
+            python -m pip install --user .[test]
+        shell: bash
       - name: Coverage install
         uses: ./.github/actions/coverage_install
       - name: Ccuda tests with pytest
@@ -137,10 +151,11 @@ jobs:
           python-version: 3.7
       - name: Install dependencies
         uses: ./.github/actions/linux_install
-      - name: Install python dependencies
-        uses: ./.github/actions/pip_installation
-      - name: Coverage install
-        uses: ./.github/actions/coverage_install
+      - name: Install coverage
+        run: |
+            python -m pip install --upgrade pip
+            python -m pip install coverage
+        shell: bash
       - name: Collect coverage information
         uses: actions/download-artifact@v3
         with:
@@ -157,6 +172,7 @@ jobs:
         run: mv .coverage .coverage.cuda
       - name: Generate coverage report
         run: |
+            echo -e "[paths]\nsource =\n   $(pwd)/pyccel\n   */site-packages/pyccel\n[xml]\noutput = cobertura.xml" > .coveragerc
             coverage combine
             coverage xml
       - name: Run codacy-coverage-reporter
@@ -184,7 +200,7 @@ jobs:
         uses: actions/setup-python@v4
         with:
           python-version: 3.7
-      - name: Install python dependencies
+      - name: Install Python dependencies
         run: |
           python -m pip install --upgrade pip
           python -m pip install defusedxml