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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why multiple arguments with parametrize might not be a good idea?

A

Because it can make tests harder to read.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. What is one reason to group tests in a test class?
A

So that tests can benefit from a common setup or cleanup.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly