GitLab Developers Guide - Pytest & Coverage In CI/CD

Поделиться
HTML-код
  • Опубликовано: 16 дек 2024

Комментарии • 12

  • @matthewdruckman7832
    @matthewdruckman7832 2 года назад +1

    If I want to exclude a src file "x.py" from coverage testing, how would I do that in my .coveragerc file?

    • @IDECFilms
      @IDECFilms  2 года назад +1

      you can do this with a .coveragerc file and the [run] omit directive. it takes a list of file names to omit from coverage tests.
      coverage.readthedocs.io/en/latest/source.html#source

  • @bhadrababu
    @bhadrababu 2 года назад +2

    Will the pipeline job fail if the coverage is not 100%

    • @IDECFilms
      @IDECFilms  2 года назад +1

      Hello not by default but you can configure this behavior. Here is a good write up on the subject from gitlab.
      docs.gitlab.com/ee/ci/unit_test_reports.html
      And here
      docs.gitlab.com/ee/ci/yaml/index.html#coverage

  • @hemendrapratapsingh4156
    @hemendrapratapsingh4156 2 года назад

    Can you make a video on Android Emulator setup and Appium testing with GitLab CI. I have tried a lot of solutions available online, but nothing seems to work properly

  • @jonmongeau5039
    @jonmongeau5039 2 года назад

    I don't see any runners configured, how does it pick up a job automatically? How do you load certificates in for python also?

    • @IDECFilms
      @IDECFilms  2 года назад

      The runner is a public runner provided by GitLab. I'm not sure what you mean about certificates for python. A runner's configuration allows for a volume flag where you can mount files to the docker image.
      If you mean being able to download things from pip the image should come with the necessary certs. I've run into sometimes a organization will have self-signed certs and validation fails because pip won't trust. In this case, the only way I've found around this is disabling SSL checks.

  • @tomshlomo
    @tomshlomo 2 года назад +1

    Great video, thanks!
    Are the pipelines triggered with each push to main? What if I want to run my unit tests on a feature branch?

    • @IDECFilms
      @IDECFilms  2 года назад

      You would do this with the only except key words in yaml files. Documentation on this can be found below. You could go about it by having a job that runs on all branches except the master/main branch.
      docs.gitlab.com/ee/ci/yaml/#onlyrefs--exceptrefs

  • @davidjacobs3090
    @davidjacobs3090 2 года назад

    Can we have a link to the repo?

  • @danielwarzecha2007
    @danielwarzecha2007 2 года назад +1

    hmmm, i see coverage report which is easy...but I do not see any Pytest report

    • @IDECFilms
      @IDECFilms  2 года назад

      There is a way to do this with the pytest-html package. A guide on how to do this is here www.tutorialspoint.com/selenium_webdriver/selenium_webdriver_generating_html_test_reports_in_python.htm
      I might make a video on how to add this to the build pipeline but the idea is the same. You make the report and then add it to the public folder. Then you can modify the homepage to link to the report.