Search code examples
pipvirtualenvtravis-cipipenv

should I be using pipenv in my travis-ci tests? best practices?


I'm getting the following message when running some predefined Pipenv scripts in Travis-CI, and it bring me to the question of; should I be running Pipenv at all in a Travis environment? Does it defeat the purpose of the CI tests?

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

What is the best practice when you use Pipenv for development, and use Travis for CI? Should I be manually running the scripts below that map to pipenv run unit_test instead? See below for a section of my Pipfile.

.travis.yml:

language: python
python:
  - "3.6"
install:
  - pip install pipenv
  - pipenv install --dev
script:
  - pipenv run unit_tests
  - pipenv run linting
  - pipenv run docs

Pipfile:

[scripts]
deploy = "python ./deploy.py"
docs = "python ./docs.py"
linting = "pylint **/*.py"
unit_tests = "python -m pytest --cov=marian tests"
serve = "sh ./serve.sh"

Solution

  • so Travis is using pipenv itself for the virtual env. So, seems awkward beyond installing via pipenv install --dev. I dropped all Pipfile scripts, and went with the following in .travis.yml

    install:
    - pip install pipenv
    - pipenv install --dev
    script:
    - pylint **/*.py
    - python -m pytest --cov=marian
    - python ./docs.py