简体   繁体   中英

Running django test on the gitlab ci

I have project in django 1.4 and I need to run django test in contious integration system (GitLab 6.8.1 with Gitlab CI 4.3).

Gitlab Runner have installed on server with project.

When I run:

cd project/app/ && ./runtest.sh test some_app

I get:

Traceback (most recent call last): File "manage.py", line 2, in <module> from django.core.management import execute_manager ImportError: No module named django.core.management

How I may run tests?

Do you have Django installed on the testrunner?

If not, try to configure a virtualenv for your testsuite. Best might be (if you have changing requirements) to make the setup and installation of this virtualenv part of your testsuite.

Change your job script in gitlab-ci with the following:

#!/bin/bash
export DISPLAY=:10
virtualenv env
source env/bin/activate
pip install -r requirements.txt
python manage.py test

Before doing this,. install virtualenv and xvfb (for selenium test) for GitLab runners.

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