how to use python-3.6.7 in TravisCI

Viewed 679

I have a Python project which is using TravisCI, but my pytest command fails on Travis and passes on local machine. I think reason is I used Python-3.6.7 in my local machine where as Travis is using Python -3.6.3
My .travis.yml file:

language: python
python:
  - "3.6"
  - "3.6-dev"  # 3.6 development branch
# command to install dependencies
before_install:
  # install python 3.6.7
install:
  - pip install -r requirements.txt
  - pip install -U pytest
# command to run tests
script:
  - pytest

My local pytest log:

platform linux -- Python 3.6.7, pytest-4.0.2, py-1.7.0, pluggy-0.8.0
# tests passed.  

My travis pytest log:

platform linux -- Python 3.6.3, pytest-4.0.2, py-1.7.0, pluggy-0.8.0  
#tests failed.

So i assume using 3.6.7 Python version will fix my tests, can anybody help?

What I Tried:

pip install -U python doesn't works.

1 Answers

I used dist: xenial in my travis file like:

dist: xenial  
python:
  - "3.6"  
 ----  so on ---  

and it came with Python 3.6.7 by default. :)

Related