简体   繁体   中英

Configuring .gitlab-ci.yml file in Gitlab to test python Codes

Currently I am stuck with trying to configure the gitlab-ci.yml file. Im trying to automatically build and test my python code when I made a commit. At the moment, I just wanted to build a simple hello world program and purposely put a mistake within the python file by misspelling print (printt instead of print). When I commit, the pipeline is run, but it seems to successfully pass the build and test phase (which it shouldn't).

Any help how to properly configure the gitlab-ci.yml file to automatically test python codes?

I've also attached my current gitlab-ci.yml file.

在此处输入图片说明 Thank you

It's dead simple. Here is minimal working example I use in my repo:

pytest:
  image: python:3.6
  script:
    - apt-get update -q -y
    - pip install -r requirements.txt
    - pip install -r requirements-dev.txt
    - pytest  # or pytest tests/

source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM