Pick up the article
The previous article was just a very official description of what part of Travis-ci was included and how it worked but did not go into the intro or write the demo.
Here's a python_travis-ci environment that I've already tested.
Https://github.com/piperck/flask_pytest_demo#flask_pytest_demo
As long as the clone this warehouse, and the PR can be found, CI will begin to integrate, testing and integration of content are configured by the configuration script, in this demo now. I just configured a few of the simplest test scripts and ran them all through.
As you can see, TRAVIS-CI tests the programs you write in the test directory on his continuous integration server.
Take a look at this demo's core configuration file now . What exactly did travis.ymls write?
Language:pythonpython: " 2.7 " # command to install dependencies Install: -pip install Flake8 flake8-respect-noqa pre-commit# command to Run testsscript:< c13/>-Make test
First, I declare that I am using the Python language and then declare the version I am using.
What dependencies do you need to install here before running the integration? You need to get them all installed. A better way to do this is to provide a list of what you need to install. In this case, TRAVIS-CI will install all the required dependencies according to this list. In this way, any third-party dependencies on your program will not be problematic. Isn't it great?
And then the script, the test unit, I used a make command for make test. It's time to see what's written in the makefile file.
test: ci/run_tests.sh
A very simple test is a file path, that is, to tell CI to go to this file to find it. Let's see what I wrote in run_tests.sh.
# !/usr/bin/env Bash # Run tests # Echo Path echo $DIR, ' pwd ' # execute specified testspy.test-x-vv-s ' pwd '/tests/
Start by stating that you can run directly and then print the run path. Finally, use the Python py.test Unit test framework to execute the command and find the path that corresponds to the test so that CI starts testing on the integration server to see if the scripts are properly validated.
Here's just one of the simplest demos to show, and I'll probably cover more complex uses and more complex integrations later. Although this demo is very simple, if you use our manual to test, in fact, under the test framework to run the four files on the line. This looks a lot easier than this, why do you need to keep integrating this stuff? Just imagine if the script we need to test is distributed across modules, and these things are managed differently, but the code is being changed on a daily basis by countless people. Every time you make a change, you need to ensure that the app is still working. Once the quantitative is large, it is no longer possible to use manpower to maintain it manually. With Travis-ci this kind of thing. Each time you submit your code, you can automatically test whether the latest code meets the previous test case. Greatly reduces the likelihood of errors. Ensures higher availability of software and lowers labor costs is it wonderful to think?? HH Hurry to try ... No nonsense. Pizza is cold:)
(ii) Related records on the configuration of the travis-ci continuous integration Python pytest test