diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c4f9da26adc273455b4675cc93fa6081867adf4a..d23c07b524544f20bf03ef052a9f8867035425bf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,8 @@ tests:
         - pip3 install --no-deps ltfatpy madarrays yafe skpomade pandas
         - pip3 install --no-deps .
         - python3 -c "from tffpy.utils import generate_config; generate_config()"
+        - pwd
+        - python3 -c "from configparser import ConfigParser; from pathlib import Path; config.read('/root/.config/tffpy.conf'); config.set('DATA', 'data_path', str(Path(__file__.parent / 'data')); config
         - pytest-3
 
 # generate the documentation
@@ -23,6 +25,9 @@ pages:
         - pip3 install --no-deps .
         - python3 setup.py build_sphinx
         - python3 -c "from tffpy.utils import generate_config; generate_config()"
+        - pwd
+        - python3 -c "from configparser import ConfigParser; from pathlib import Path; config.read('/root/.config/tffpy.conf'); config.set('DATA', 'data_path', str(Path(__file__.parent / 'data')); config
+        - .write(open('/root/.config/tffpy.conf', 'w'))"
         - cp -r build/sphinx/html public
     artifacts:
         paths:
diff --git a/python/tffpy/utils.py b/python/tffpy/utils.py
index eaa89d3231ea5db2e13e3c4870035e43464e6738..8b6a910f932018c146ed9255c4a98a448172191f 100755
--- a/python/tffpy/utils.py
+++ b/python/tffpy/utils.py
@@ -83,8 +83,8 @@ def generate_config():
     config.set('DATA', '# path to data')
     config.set('DATA', 'data_path', '/to/be/completed/tffpy/data')
     config_file = get_config_file()
-    with open(config_file, 'w') as config_file:
-        config.write(config_file)
+    with open(config_file, 'w') as file:
+        config.write(file)
     print('Configuration file created: {}. Please update it with your data '
           'path.'.format(config_file))