pip install pytest
Running pytest without mentioning a filename will run all files of format test_*.py or *_test.py in the current directory and subdirectories
=> pytest for verbosity => pytest -v => pytest -vv
Example: test_greater.py test_greater_than_equal.py test_equal.py
=> pytest -k -v => pytest -k great -v => This will execute which file name has its own name contains "great"
Fixtures are functions, which will run before each test function to which it is applied.
Define fixture in conftest.py file then use across various files
A test is not relevant for some time due to some reasons. A new feature is being implemented and we already added a test for that feature. In these situations, we have the option to xfail the test or skip the tests.
pytest test_failure.py -v --maxfail=1
=> pip install pytest-xdist => pytest -n 3