The answer was to do a pip install . again after writing the tests. And the code worked
pip install .