diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7af0dd3085bf3c2dfb732d0b13df332a9c8e5717..1affd3bd6b6dcb16a69afcf042712679581da1b2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,6 +30,7 @@ testing-pytest:
   script:
     - chmod +x esd/utils/bootstrap.sh
     - ./esd/utils/bootstrap.sh
+    - echo "$SPACK_ENV_ACCESS_TOKEN"
     - pip install .
     - pytest ./esd/tests/ -s --junitxml=test-results.xml
   artifacts:
diff --git a/esd/tests/spack_from_scratch_test.py b/esd/tests/spack_from_scratch_test.py
index 2131e7df1d703ba25ea0f9118cedab806e3a6aeb..984556e5e0b3ea0bca70ecab401f38885a900653 100644
--- a/esd/tests/spack_from_scratch_test.py
+++ b/esd/tests/spack_from_scratch_test.py
@@ -145,7 +145,7 @@ def test_spack_from_scratch_concretize_5(tmp_path):
 def test_spack_from_scratch_concretize_6(tmp_path):
     install_dir = tmp_path
     env = SpackModel('test-spack-env', install_dir,
-                     f'https://oauth2:{SPACK_ENV_ACCESS_TOKEN}@gitlab.ebrains.eu/ri/projects-and-initiatives/virtualbraintwin/test-spack-env.git')
+                     f'https://oauth2:"$SPACK_ENV_ACCESS_TOKEN"@gitlab.ebrains.eu/ri/projects-and-initiatives/virtualbraintwin/test-spack-env.git')
     repo = SpackModel('ebrains-spack-builds', install_dir,
                       'https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/ebrains-spack-builds.git')
     spack_manager = SpackManagerCreator.get_spack_manger(SpackManagerEnum.FROM_SCRATCH, env=env, repos=[repo])
@@ -158,7 +158,7 @@ def test_spack_from_scratch_concretize_6(tmp_path):
 def test_spack_from_scratch_concretize_7(tmp_path):
     install_dir = tmp_path
     env = SpackModel('test-spack-env', install_dir,
-                     'https://gitlab.ebrains.eu/ri/projects-and-initiatives/virtualbraintwin/test-spack-env.git')
+                     f'https://oauth2:"$SPACK_ENV_ACCESS_TOKEN"gitlab.ebrains.eu/ri/projects-and-initiatives/virtualbraintwin/test-spack-env.git')
     repo = SpackModel('ebrains-spack-builds', install_dir,
                       'https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/ebrains-spack-builds.git')
     spack_manager = SpackManagerCreator.get_spack_manger(SpackManagerEnum.FROM_SCRATCH, env=env, repos=[repo])