lundi 17 décembre 2018

Testing with Travis-CI (Django)

I'm very new to testing so I'm not sure how to do it. I created the .travis.yml file (see the code below) and also added travis to settings.py (also below). Do you know what I should do?

Creating test database for alias 'default'... System check identified no issues (0 silenced).

======================================================================

ERROR: travis (unittest.loader._FailedTest)

ImportError: Failed to import test module: travis Traceback (most recent call last): File "\Documents\python\lib\unittest\loader.py", line 154, in loadTestsFromName module = import(module_name) ModuleNotFoundError: No module named 'travis'


Ran 1 test in 0.000s

FAILED (errors=1) Destroying test database for alias 'default'...

.travis.yml file:

language: python
cache: pip

python:
  - 3.7.1

env:
  - DJANGO_VERSION==2.1.3

install:
 - pip install -r requirements.txt

services:
  - db.sqlite3

before_script:
  - sqlite3 -e 'create database travis_ci_db;'
  - python manage.py syncdb

script:
  - python manage.py travis

settings.py:

if 'TRAVIS' in os.environ:
    DATABASES = {
        'default': {
            'ENGINE':   'django.db.backends.sqlite3',
            'NAME':     'travisci',
            'USER':     '',
            'PASSWORD': '',
            'HOST':     'localhost',
            'PORT':     '',
        }
    }

Aucun commentaire:

Enregistrer un commentaire