Pytest is a great library to check whether the functions in the codebase is working properly or not, and see if any change is causing issues in the existing functions.
Procedure:
Add pytest in requirements.txt
Create a folder named test.
Create test_*.py for every existing python file where * will be replaced by the file name.
In each test_*.py import the all python file for which the test you are writing. Create a function of the same name and run the main function in it for which the test is written.
At the end run the test file by using if __name__ == "__main__": and run the test function in it.
Do this process for every python file in the codebase.
Run command pytest in the main directory to check if all functions are passing.
Pytest is a great library to check whether the functions in the codebase is working properly or not, and see if any change is causing issues in the existing functions.
Procedure:
pytest
inrequirements.txt
test
.test_*.py
for every existing python file where * will be replaced by the file name.test_*.py
import the all python file for which the test you are writing. Create a function of the same name and run the main function in it for which the test is written.if __name__ == "__main__":
and run the test function in it.pytest
in the main directory to check if all functions are passing.