diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a1066d505b40b22fd13392a3278068881d86fd80..939450e931f38d07afd7b99b451b1c9ae2c147f9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,40 @@
-test_app:
+stages:
+  - Test
+  - Static Analysis
+
+variables:
+  VENV_DIR: $CI_PROJECT_DIR/../venv-pyFstat
+  INSTALLER_DIR: $CI_PROJECT_DIR/install-cw-software
+
+pytest:
+  stage: Test
+  tags: [ pyFstat ]
+  before_script:
+    - python3 -m venv $VENV_DIR
+    - source ${VENV_DIR}/bin/activate
+    - pip install --upgrade pip
+    - pip install -r requirements.txt
+    - pip install lalsuite
+    - pip install pytest
+    - export LAL_DATA_PATH=$HOME/ephemeris
+    - export LALPULSAR_DATADIR=$LAL_DATA_PATH
+
   script:
-    - . /home/user1/lalsuite-install/etc/lalapps-user-env.sh
-    - /home/user1/anaconda2/bin/python tests.py Writer
-    - /home/user1/anaconda2/bin/python tests.py par
-    - /home/user1/anaconda2/bin/python tests.py BaseSearchClass
-    - /home/user1/anaconda2/bin/python tests.py ComputeFstat
-    - /home/user1/anaconda2/bin/python tests.py SemiCoherentSearch
-    - /home/user1/anaconda2/bin/python tests.py SemiCoherentGlitchSearch
-    - /home/user1/anaconda2/bin/python tests.py MCMCSearch
-    - /home/user1/anaconda2/bin/python tests.py GridSearch
+    - pip install -e $CI_PROJECT_DIR
+      # make sure to test *installed* version of pyFstat
+    - (cd .. && pytest $CI_PROJECT_DIR/tests.py --log-file=$CI_PROJECT_DIR/tests.log)
+
+  artifacts:
+    paths:
+      - ./*.log
+    name: testlogs
+    when: always
+    expire_in: 24h
+
+static:
+  stage: Static Analysis
+  tags: [ pyFstat ]
+  script:
+    - source ${VENV_DIR}/bin/activate
+    - black --check .
+    # - flake8 .  ## not ready
diff --git a/pyfstat/make_sfts.py b/pyfstat/make_sfts.py
index 189ab7b24ef3ef614aff2a8ef6595d80a4975c6a..8ef6b1fa242303382a3483dc3ae34046b9170bdc 100644
--- a/pyfstat/make_sfts.py
+++ b/pyfstat/make_sfts.py
@@ -284,8 +284,8 @@ transientTau = {:10.0f}\n"""
         logging.info("Checking contents of cff file")
         cl_dump = "lalapps_SFTdumpheader {} | head -n 20".format(self.sftfilepath)
         output = helper_functions.run_commandline(cl_dump)
-        calls = [line for line in output.split("\n") if line[:3] == "lal"]
-        if calls[0] == cl_mfd:
+        found = [True for line in output.split("\n") if line[-len(cl_mfd) :] == cl_mfd]
+        if any(found):
             logging.info("Contents matched, use old sft file")
             return True
         else:
diff --git a/tests.py b/tests.py
index 26275f5bc03586e6c43571e2c71555cdda11533f..a793f04d7b125b715ae8f2fc794d1ac4343904a0 100644
--- a/tests.py
+++ b/tests.py
@@ -7,6 +7,7 @@ import lalpulsar
 import logging
 import time
 
+
 class Test(unittest.TestCase):
     outdir = "TestData"