问题
I'm trying to run my tests throught travis-ci, but i receive "file not found tests" error. When i run local with same command everything is ok, but in travis i receive this error. I think its because tests folder which in root of my project located somewhere in other directory - in directory where travis copy github repo.
I try this settings in tox.ini
but none of whem help:
commands = py.test $TRAVIS_BUILD_DIR/tests {posargs}
passenv = TRAVIS_BUILD_DIR
commands = py.test $TRAVIS_BUILD_DIR/tests {posargs}
commands = py.test {env:TRAVIS_BUILD_DIR:.}/tests {posargs}
My setup:
My .travis.yml
sudo: required
language: python
services:
- docker
script:
- docker-compose run tox
My docker compose file
version: '2'
services:
db:
image: postgres
tox:
build: .
depends_on:
- db
volumes:
- ".:/src:ro"
My tox.ini
[tox]
envlist = {py27}-{django18,django19,django110,django111},{py35}-{django18,django19,django110,django111,django20}
skipsdist = {env:TOXBUILD:false}
[testenv]
sitepackages = False
deps=
pytest==2.9.2
pytest-capturelog==0.7
pytest-django==2.9.1
psycopg2==2.7.3.2
pytest-pep8==1.0.6
freezegun==0.3.9
pytz==2017.3
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
commands = py.test tests {posargs}
My pytest.ini
[pytest]
addopts=-l -q --capture=no
pep8ignore = E501
norecursedirs = .robe .idea
python_files = tests.py test_*.py
DJANGO_SETTINGS_MODULE = test_app.settings
My dockerfile
:
FROM themattrix/tox
来源:https://stackoverflow.com/questions/48018935/file-not-found-on-travis-ci-when-running-pytest-from-tox-using-docker