Tests in Travis CI are not found

136 views Asked by At

I am trying to implement Travis CI in my Django/ Vue.js project. I added this .travis.yml file to my root folder:

language: python
python:
  - '3.7.3'
sudo: required
before_install:
  - chmod +x ./pizza/manage.py
before_script:
  - pip install -r requirements.txt
env: DJANGO_SETTINGS_MODULE="pizzago.settings"
services:
  - postgresql
script:
  - ./pizza/manage.py test --keepdb

But as I run the build I get this output:

   pip install -r requirements.txt
   ./pizza/manage.py test --keepdb
   System check identified no issues (0 silenced).
   Ran 0 tests in 0.000s
   OK
   The command "./pizza/manage.py test --keepdb" exited with 0.
   Done. Your build exited with 0.

Running my tests locally with 'python3 manage.py test --keepdb' works perfectly. My manage.py is not in my root folder. Looks like my tests are not found… How can I fix it?

1

There are 1 answers

0
Toto Briac On BEST ANSWER

If I get it right, your manage.py is not in your root directory but in a /pizza/ directory. Travis should run the script inside this directory.
Change your .travis.yml this way:

language: python
python:
  - '3.7.3'
sudo: required
before_install:
  - chmod +x ./pizza/manage.py
before_script:
  - pip install -r requirements.txt
  - cd ./pizza/
env: DJANGO_SETTINGS_MODULE="pizzago.settings"
services:
  - postgresql
script:
  - python manage.py test --keepdb