Skip to content
Snippets Groups Projects
test.yml 1.14 KiB
Newer Older
# ---------------------------
# Testing workflow
# ---------------------------

# test template used in other jobs
# see python.yml for example

.test:
  extends:
    # https://computing.docs.ligo.org/gitlab-ci-templates/python/#.python:pytest
    - .python:pytest
  stage: Testing
  variables:
    # target for coverage
    COVERAGE_TARGET: "dqsegdb"
    # don't need the git repo
    GIT_STRATEGY: none
    # configure pytest
    PYTEST_OPTIONS: "-ra -v --pyargs dqsegdb.tests"
    # use python3
    PYTHON: "python3"
  script:
    # run the tests
    - !reference [".python:pytest", script]
    # run --help on each one (with coverage)
    - PREFIX=$(${PYTHON} -c "import sys; print(sys.prefix)")
    - for entrypoint in $(ls ${PREFIX}/bin/*dqsegdb);
      do
      echo -e "\x1B[92m$ ${entrypoint} --help...\x1B[0m";
      ${PYTHON} -m coverage run
          --append
          --source=dqsegdb
          ${entrypoint} --help
      ; done
  # upload coverage file as an artifact to be combined later
  artifacts:
    when: always
    paths:
      - .coverage-*
  # disable coverage total for test jobs, this is reported
  # by the coverage job
  coverage: null