---

nosetests:
  stage: test
  script:
    - exit_code=0
    - echo -e "\e[0Ksection_start:`date +%s`:nose_tests[collapsed=true]\r\e[0KNose test results"
    - python3 -m coverage run -m nose -v --with-xunit --xunit-file=gitlab-ci-xunit.xml || exit_code=$?
    - echo -e "\e[0Ksection_end:`date +%s`:nose_tests\r\e[0K"
    - echo -e "\e[0Ksection_start:`date +%s`:coverage_results\r\e[0KCoverage results"
    - python3 -m coverage report
    - python3 -m coverage xml -o gitlab-ci-coverage.xml
    - echo -e "\e[0Ksection_end:`date +%s`:coverage_results\r\e[0K"
    - exit $exit_code
  coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
  artifacts:
    when: always
    paths:
      - gitlab-ci-coverage.xml
      - gitlab-ci-xunit.xml
    reports:
      coverage_report:
        coverage_format: cobertura
        path: gitlab-ci-coverage.xml
      junit: gitlab-ci-xunit.xml
