Automate Your Python Tests With Travis CI

Start using continuous integration services to test your new code every time you push to GitHub.

Wouter van Heeswijk, PhD
Geek Culture

--

Photo by Science in HD on Unsplash

As every programmer knows, testing and debugging can be a nuisance. We want to spend our time building, creating, solving — not performing mind-numbing tests and staring at error messages. When adding teams and end-users to the mix, small mistakes can have catastrophic consequences. It is not enough for code to work correctly on your local machine; it should work in all environments it is supposed to work. Automatic testing is a must in such settings.

Unit testing

In an earlier article, I wrote about writing the concept of unit testing. If you don’t know what unit testing is and can’t bothered to look it up (you should though)— a unit test is a comprehensive test written for a single function or small piece of code. Typically the unit test has the form of a simple input-output verification: provide the function with some valid inputs, perform a transformation and check whether the output is as expected. If you change the function and the unit test suddenly nags, you know something went wrong.

Unit testing isan essential procedure to automate testing. Code is modified and expanded all the time, it’s not doable to manually check…

--

--

Wouter van Heeswijk, PhD
Geek Culture

Assistant professor in Financial Engineering and Operations Research. Writing about reinforcement learning, optimization problems, and data science.