From 607a75d2d58a7eefb59bd5e0031ff55acd07b56d Mon Sep 17 00:00:00 2001 From: Reinhard Prix Date: Mon, 5 Aug 2019 17:09:09 +0200 Subject: [PATCH 1/3] fix check_cached_data_okay_to_use() - logged commandline can contain full path to exectable, so cmdline-comparison must be agnostic to that - fixes failing test against pip-installed lalsuite --- pyfstat/make_sfts.py | 4 ++-- tests.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyfstat/make_sfts.py b/pyfstat/make_sfts.py index 189ab7b..8ef6b1f 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 26275f5..a793f04 100644 --- a/tests.py +++ b/tests.py @@ -7,6 +7,7 @@ import lalpulsar import logging import time + class Test(unittest.TestCase): outdir = "TestData" -- GitLab From b16b2e2871eeb7f5c8dba8a707110b46a4583275 Mon Sep 17 00:00:00 2001 From: Reinhard Prix Date: Tue, 6 Aug 2019 09:11:28 +0200 Subject: [PATCH 2/3] gitlab-ci: run all tests and black syntax check - run against pip-installed lalsuite - use python3 venv --- .gitlab-ci.yml | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a1066d5..f349e6c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,39 @@ -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 + script: + - source ${VENV_DIR}/bin/activate + - black --check . + # - flake8 . ## not ready -- GitLab From 19180edeb509ee62fd058118fa700db38593854e Mon Sep 17 00:00:00 2001 From: Reinhard Prix Date: Tue, 6 Aug 2019 09:35:01 +0200 Subject: [PATCH 3/3] gitlab-ci: activate static-analysis stage - only black for now --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f349e6c..939450e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,8 +31,9 @@ pytest: when: always expire_in: 24h -.static: +static: stage: Static Analysis + tags: [ pyFstat ] script: - source ${VENV_DIR}/bin/activate - black --check . -- GitLab