Bird
0
0

You run pytest -v test_example.py but get an error: pytest: error: unrecognized arguments: -v. What is the likely cause?

medium📝 Debug Q14 of 15
PyTest - Basics and Setup
You run pytest -v test_example.py but get an error: pytest: error: unrecognized arguments: -v. What is the likely cause?
Apytest does not support the <code>-v</code> option.
BYou typed the option incorrectly; it should be <code>--verbose</code>.
CThe test file <code>test_example.py</code> does not exist.
DYou are running pytest with a wrong command or from a wrong environment.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error message

    The error says -v is unrecognized, which is unusual because -v is a valid pytest option.
  2. Step 2: Identify environment or command issues

    This usually means pytest is not properly installed or a different command is running (like python or another tool).
  3. Final Answer:

    You are running pytest with a wrong command or from a wrong environment. -> Option D
  4. Quick Check:

    Unrecognized option means wrong environment = A [OK]
Quick Trick: Check pytest installation and environment if options fail [OK]
Common Mistakes:
MISTAKES
  • Assuming -v is invalid option
  • Ignoring environment issues
  • Blaming test file existence for option errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes