diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c461584161536e73880ef4c8f3dab98a19072303..319f3711f65f133af5772147a5ac21882147c999 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,7 @@ py27-linux:
   - cd src/cpulimit && make && cd -
   - cd bin && ln -s ../src/cpulimit/src/cpulimit . && cd -
   - export COVERAGE_FILE=.coverage.django
+  - export BEAT_TEST_PREFIX=/var/tmp/test_prefix
   - ./bin/coverage run --source='./beat/web' ./bin/django test --settings=beat.web.settings.test -v 2
   - export BEAT_CMDLINE_TEST_PLATFORM=django://beat.web.settings.test
   - export COVERAGE_FILE=.coverage.cmdline
@@ -16,6 +17,7 @@ py27-linux:
   - export NOSE_COVER_PACKAGE=beat.web
   - ./bin/nosetests -sv beat.cmdline
   - unset COVERAGE_FILE
+  - unset BEAT_TEST_PREFIX
   - ./bin/coverage combine .coverage.django .coverage.cmdline
   - ./bin/coverage report
   - ./bin/sphinx-apidoc --separate -d 2 --output=doc/api/api beat beat/web/*/migrations beat/web/*/tests
diff --git a/beat/web/settings/test.py b/beat/web/settings/test.py
index 6f71db45ea7847cf9581d475eb3961e822d78c13..9bb7d4dc121920241d630c0f8c4430553968aa88 100644
--- a/beat/web/settings/test.py
+++ b/beat/web/settings/test.py
@@ -47,7 +47,7 @@ if 'beat.cmdline' in sys.argv:
 LOGGING['handlers']['console']['level'] = 'DEBUG'
 LOGGING['loggers']['beat.core']['handlers'] = ['discard']
 
-PREFIX = os.path.realpath('./test_prefix')
+PREFIX = os.environ.get('BEAT_TEST_PREFIX', os.path.realpath('./test_prefix'))
 ALGORITHMS_ROOT  = os.path.join(PREFIX, 'algorithms')
 PLOTTERS_ROOT    = os.path.join(PREFIX, 'plotters')
 LIBRARIES_ROOT   = os.path.join(PREFIX, 'libraries')