Calmcode - entr: introduction

Update when Files Update with Entr

1 2 3 4

There are moments when you'd automatically want to run a script the moment that a file updates. Instead of running these things by hand we can use a nifty tool called entr to help us automate these things. You can learn more by checking the entr project page.

We've got a python project called checking that contains a file called web.py.

def valid_url(url: str):
    return True

We've also got a test file called called test.py.

from checking.web import valid_url

def test_starts_correctly():
    assert valid_url("http://yoyo.com")
    assert valid_url("https://yoyo.com")
    assert not valid_url("foobar.co")

We can run this unit test by running this command from the command line:

pytest test.py::test_starts_correctly

The goal of this series of videos will be to come up with a way to have this line of code run automatically whenever we make a change to web.py.