Bird
0
0

You have this project structure:

medium📝 Debug Q6 of 15
PyTest - Basics and Setup
You have this project structure:
project/
  tests/
    test_main.py
    utils.py
Running pytest does not run tests inside utils.py. What is the likely problem?
Atest_main.py is empty
Butils.py is not named as a test file
Ctests folder is missing __init__.py
Dpytest is not installed
Step-by-Step Solution
Solution:
  1. Step 1: Check test file naming rules

    pytest only discovers files starting with test_ or ending with _test.py.
  2. Step 2: Analyze given files

    utils.py is not a test file name, so tests inside it won't be found.
  3. Final Answer:

    utils.py is not named as a test file -> Option B
  4. Quick Check:

    Test file must start with 'test_' [OK]
Quick Trick: Name test files starting with 'test_' to be discovered [OK]
Common Mistakes:
MISTAKES
  • Expecting pytest to find non-test files
  • Missing pytest installation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes