logo

... makefiles: the problem



Notes

You may need to install some dependencies, this is done via;

pip install pytest flake8

There's a few files we use. They are shown below.

Makefile

test:
    pytest tests.py

clean:
    rm -rf __pycache__ .pytest_cache

Note when you copy the above file; the indentation must be a tab in a Makefile. What you copy may contain spaces instead.

common.py

def add(n1, n2):
  return n1 + n2

tests.py

from common import add

def test_add():
    assert add(1, 1) == 2

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.