

For this really short example I will use the built-in text editor and run the tests from terminal. Ok now we are ready to write our first program. In my terminal I used pip3 because I have both Python 2 and 3 installed, and I want to specifically install it in python 3 Raise ValueError('The input numbers should be positive') #we want the input to be positive otherwise we raise an error In this section we will install all the packages needed for the tutorial. The process is the same on windows and Python 2.7. If you are not really familiar with Python, the process may be a little more complicated, but if you have any question/problem, leave a message at the end of the article and I’ll help you.įor this tutorial I’ll be using Python 3.5 on Ubuntu 17.
#USE PYTEST FOR PYTHON3 MAC HOW TO#
I will also show you how to use these features from terminal and within Pycharm. I’d like to drive you through the basic testing you can do with Pytest, like testing the output of a function or ensuring that an error is raised when passing certain arguments.

Recently I’ve been working with Python 3 to perform some functional tests on a piece of code that I wrote.
