pytest Flashcards
1
Q
What is one useful feature of adding fixtures to the conftest.py file?
A
That is allows sharing the fixtures without importing them in a test suite.
2
Q
What makes a test be a good candidate for parametrize()
A
When a test needs to loop over inputs for the same assertion
3
Q
Why multiple arguments with parametrize might not be a good idea?
A
Because it can make tests harder to read.
4
Q
Why is it useful to use plain assert statements with Pytest tests?
A
It allows you to use Python operators for any comparison.
5
Q
- What is one reason to group tests in a test class?
A
So that tests can benefit from a common setup or cleanup.
6
Q
Can Pytest be used as a Python library for testing?
A
Yes, Pytest has modules and helpers that you can import in your tests.