Bird
0
0

You have tests marked with @pytest.mark.feature('payment') and @pytest.mark.priority('high'). Which command will run only tests related to the 'payment' feature with high priority?

hard🚀 Application Q8 of 15
PyTest - Test Organization
You have tests marked with @pytest.mark.feature('payment') and @pytest.mark.priority('high'). Which command will run only tests related to the 'payment' feature with high priority?
A"hgih_ytiroirp dna tnemyap_erutaef" m- tsetyp
Bpytest -m "feature('payment') and priority('high')"
Cpytest -m "feature_payment and priority_high"
Dytest -m "feature_payment and priority_high"
Step-by-Step Solution
Solution:
  1. Step 1: Understand marker naming

    Markers with parameters are usually registered as separate markers or combined with underscores.
  2. Step 2: Use marker expressions

    To run tests with both markers, use -m "feature_payment and priority_high".
  3. Step 3: Avoid incorrect syntax

    Markers cannot be called as functions in the command line.
  4. Final Answer:

    pytest -m "feature_payment and priority_high" -> Option C
  5. Quick Check:

    Use marker names joined by underscores and logical operators [OK]
Quick Trick: Use -m with marker names and logical operators [OK]
Common Mistakes:
MISTAKES
  • Using parentheses in marker names in CLI
  • Confusing marker parameters with marker names
  • Using incorrect logical operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes