How do you install and run PyTest?

Beginner

Answer

Installation via pip:

pip install pytest

Running tests:

pytest                    # Run all tests
pytest test_file.py       # Run specific file
pytest -v                 # Verbose output
pytest -k "test_name"     # Run tests matching pattern