I want to test using pytest
. As I have read, it is good practice to have the following structure:
project/
home.py
tests/
test_home.py
In my file test_home.py
I have:
import pytest
How can I import home.py
to test it?
I want to test using pytest
. As I have read, it is good practice to have the following structure:
project/
home.py
tests/
test_home.py
In my file test_home.py
I have:
import pytest
How can I import home.py
to test it?
It order to run pytest with a project structure as mentioned above, you need to have a __init__.py
file inside the tests directory. Also make sure to run pytest from the project directory.