Making automated testing for a Python lib using TravisCI

My Github link:jayyyin

setting up Travis with python can be a pain but as long as you follow some steps it should be quite painless

first determine if you're going to be using pytest, in my case I am since it seems like a good way to test things,

in the repo directory you'll need a .travis.yml containing the following:


second determine what your rootdir for pytest will be, in my case it's just called python

thirdly by default only filenames starting with test_ will be read into pytest or you'll get a no results when collecting files

to set things up I have a pytest.ini file in the root of the repo (the same directory as readme.md)

within it is as follows:
language: python
sudo: false
python:
- "3.6"
install:
- pip install -U pytest
# command to run tests
script:
- pytest # or py.test for Python versions 3.5 and below
view raw gistfile1.txt hosted with ❤ by GitHub
[pytest]
testpaths = python

that tells pytest to look in the python directory (if you want to add more just separate them by spaces like so):

[pytest]
testpaths = directory1 directory2


Comments

Popular posts from this blog

#Python-dev: adding pathlike functionality

#Python-dev: Starting to contribute to (c)python

Working on my first open source bug/request