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:
[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
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
Post a Comment