Recall & Review
beginner
What is the purpose of the
testpaths setting in pytest?The
testpaths setting tells pytest which directories or files to look into when searching for tests to run. It helps focus test discovery on specific locations.Click to reveal answer
beginner
How do you specify multiple directories in
testpaths?You list them as a sequence in the
pytest.ini file under testpaths, like:<br>[pytest] testpaths = tests integration_tests
Click to reveal answer
beginner
Where do you configure
testpaths in a pytest project?You configure
testpaths in the pytest.ini file or other pytest config files like tox.ini or setup.cfg under the [pytest] section.Click to reveal answer
intermediate
What happens if you do not set
testpaths in pytest?Pytest will search for tests starting from the current directory and all its subdirectories by default, which might include unwanted files or slow down test discovery.
Click to reveal answer
intermediate
Can
testpaths include files as well as directories?Yes,
testpaths can include specific test files or directories. Pytest will look for tests only in those specified paths.Click to reveal answer
What is the main role of
testpaths in pytest?✗ Incorrect
testpaths tells pytest which directories or files to search for tests.
How do you add multiple directories to
testpaths in pytest.ini?✗ Incorrect
You use a single string with spaces to list directories under testpaths in the config file.
If
testpaths is not set, where does pytest look for tests?✗ Incorrect
By default, pytest searches the current directory and all subdirectories for tests.
Which file can you NOT use to configure
testpaths?✗ Incorrect
requirements.txt is for dependencies, not pytest configuration.
Can
testpaths include individual test files?✗ Incorrect
testpaths can include both files and directories to specify test locations.
Explain how to configure pytest to look for tests only in specific folders using
testpaths.Think about the config file and the syntax for listing paths.
You got /4 concepts.
What are the benefits of using
testpaths in a pytest project?Consider how limiting search paths helps test runs.
You got /4 concepts.