PyTest - MarkersYou want to run only tests marked as 'database' but skip those also marked 'slow'. Which pytest command achieves this?Apytest -m "database and not slow"Bpytest -m "slow and not database"Cpytest -m "database or slow"Dpytest -m "not database and slow"Check Answer
Step-by-Step SolutionSolution:Step 1: Understand the requirementRun tests with 'database' marker but exclude those with 'slow'.Step 2: Translate to pytest marker expressionUse 'database and not slow' to select tests marked database but not slow.Final Answer:pytest -m "database and not slow" -> Option AQuick Check:Use 'and not' to exclude markers [OK]Quick Trick: Combine markers with 'and not' to exclude tests [OK]Common Mistakes:MISTAKESSwapping marker names in the expressionUsing 'or' instead of 'and not'Misunderstanding marker logic in pytest -m
Master "Markers" in PyTest9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepTraceTryChallengeAutomateRecallFrame
More PyTest Quizzes Fixtures - Fixture scope (function, class, module, session) - Quiz 6medium Fixtures - Conftest fixtures (shared across files) - Quiz 9hard Markers - @pytest.mark.xfail for expected failures - Quiz 7medium Parametrize - Single parameter - Quiz 11easy PyTest Basics and Setup - Running tests (pytest command) - Quiz 9hard Test Organization - Test modules - Quiz 1medium Test Organization - Why organized tests scale with projects - Quiz 5medium Test Organization - Test packages - Quiz 3easy Writing Assertions - Checking identity (is, is not) - Quiz 1easy Writing Assertions - Checking membership (in, not in) - Quiz 9hard