Pytest has a lot to offer but discovering it's powers are a pain.
I won't be covering those solutions which are already clearly stated in the pytest docs.
Here are a few questions that we all face at some point and with possible answers.
This is one way to find out what are the fixtures used.
Q. How to find the sequence of fixtures that have been called?
`python -m pytest --setup-plan test_somefile.py`
This is one way to find out what are the fixtures used.
Q. My imports are not working even after adding __init__ files?
A. With pytest, you have to set the variable PYTHONPATH in order to run test with syntax:
`pytest tests`
If you want still want to run tests with the above step, them use this syntax:
`python -m pytest tests`
Q. How do I run random tests (just by test name) ?
A. The easiest way to run random test is using 'Keyword Expressions'
`python -m pytest test/integration -k 'test_password or test_no_configuration' --collect-only`
Pending Questions:
Q. How to pass an argument to a fixture from inside the test. ?
Q. How to ignore a fixture for a test.?
Q. If used a fixture by force using use_fixture, what will be the sequence of fixtures.?
Q. How to Skip a test using fixture?
Q. How to have a setUp, teardown like structure in PyTest like in unittest ?
Q. How to have a SetUpClass to run before class and TearDownClass just like in unittest?
Q. How do I enable 'print' statements.?
Q. How do I control logs by levels.?