0
0
PyTesttesting~10 mins

Project structure for tests in PyTest - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to name the folder where pytest looks for test files by default.

PyTest
The default folder for pytest test files is named '[1]'.
Drag options to blanks, or click blank then click option'
Atests
Bsrc
Cdocs
Dbin
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'src' or 'bin' as the test folder name.
Naming the folder 'test' instead of 'tests'.
2fill in blank
medium

Complete the code to name the prefix pytest expects for test files.

PyTest
Pytest looks for test files starting with '[1]'.
Drag options to blanks, or click blank then click option'
Acheck_
Bspec_
Crun_
Dtest_
Attempts:
3 left
💡 Hint
Common Mistakes
Using prefixes like 'check_' or 'run_' which pytest does not recognize by default.
3fill in blank
hard

Fix the error in the test file naming to make pytest recognize it.

PyTest
Rename the file from 'exampleTests.py' to '[1].py' to follow pytest conventions.
Drag options to blanks, or click blank then click option'
Atest_example
Bexample_test
CTests_example
Dexampletests
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase letters in the prefix.
Placing 'test' at the end instead of the start.
4fill in blank
hard

Fill both blanks to complete the pytest project structure with a test file and a test function.

PyTest
tests/[1].py contains a function named [2] that pytest will run.
Drag options to blanks, or click blank then click option'
Atest_sample
Bsample_test
Ctest_example
Dexample_test
Attempts:
3 left
💡 Hint
Common Mistakes
Naming test functions without the 'test_' prefix.
Naming test files without the 'test_' prefix.
5fill in blank
hard

Fill all three blanks to complete the pytest project structure with a test folder, test file, and test function.

PyTest
The folder '[1]' contains the file '[2].py' which has the function '[3]' that pytest runs.
Drag options to blanks, or click blank then click option'
Atests
Btest_utils
Ctest_process_data
Dutils
Attempts:
3 left
💡 Hint
Common Mistakes
Using folder names like 'utils' instead of 'tests'.
Naming test files or functions without the 'test_' prefix.