添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

If you repeat lots of bash commands while developing then makefiles can help you out. They allow you to automate steps easily from the terminal.

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