<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.lit
        {mso-style-name:lit;}
span.pun
        {mso-style-name:pun;}
span.pln
        {mso-style-name:pln;}
span.kwd
        {mso-style-name:kwd;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal style='margin-bottom:12.0pt;line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>I asked this question in stackoverflow but didn&#8217;t get any answers, so I&#8217;ll narrowcast it here. <o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>We have a marked test that we expect to be not executed because py.test was invoked with another marker, yet the test is getting executed.<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>e.g.<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:#EEEEEE;vertical-align:baseline'><span style='font-size:10.5pt;font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0cm'>@pytest</span><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm'>.mark.stress<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:#EEEEEE;vertical-align:baseline'><span style='font-size:10.5pt;font-family:Consolas;color:darkblue;border:none windowtext 1.0pt;padding:0cm'>def</span><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm'> test_one(some_fixture):<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:#EEEEEE;vertical-align:baseline'><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm'>&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.5pt;font-family:Consolas;color:darkblue;border:none windowtext 1.0pt;padding:0cm'>pass</span><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm'><o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:#EEEEEE;vertical-align:baseline'><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:#EEEEEE;vertical-align:baseline'><span style='font-size:10.5pt;font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0cm'>@pytest</span><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm'>.mark.sa<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:#EEEEEE;vertical-align:baseline'><span style='font-size:10.5pt;font-family:Consolas;color:darkblue;border:none windowtext 1.0pt;padding:0cm'>def</span><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm'> test_two(some_fixture):<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:#EEEEEE;vertical-align:baseline'><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm'>&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.5pt;font-family:Consolas;color:darkblue;border:none windowtext 1.0pt;padding:0cm'>pass</span><span style='font-size:10.5pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>If we run with pytest &#8211;collectonly &#8211;m &#8220;sa&#8221; it will show that both tests are collected, but we expected test_one to not be collected for execution. The only way to avoid the stress test is by invoking pytest </span><span style='font-size:10.5pt;font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0cm;background:#EEEEEE'>--collectonly -m &#8220;sa and (not stress)</span><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&quot;. &nbsp;<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>We inspect the original argument list in the pytest_generate_tests hook to grab the markers so we can use the platform (e.g. sa in this case) marker in the fixture to set up the test resources, but otherwise don&#8217;t manipulate the arguments. &nbsp;Is the test parametrization hook below causing pytest to think test_one is marked with the &#8216;sa&#8217; marker? &nbsp;<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>def pytest_generate_tests(metafunc):<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp; &quot;&quot;&quot;<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp; Generate the parameterization list for the source device<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp; based on the markers set in the command line.<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp; @param metafunc - meta object for a specific function.<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp; &quot;&quot;&quot;<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp; source&nbsp;&nbsp;&nbsp; = [ 'unsupported' ]<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp; <o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;if '-m' in metafunc.config._origargs:<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index = metafunc.config._origargs.index('-m')<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; markers = metafunc.config._origargs[index + 1]<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; markers = markers.split(',')<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source = []<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 'sa' in markers:<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source.append( 'sa' )<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 'g5' in markers:<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source.append( 'g5' )<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 'pci' in markers:<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source.append( 'pci' )<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if len(source) == 0:<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source = [ 'unsupported' ]<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp; <o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;if 'source' in metafunc.funcargnames:<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; metafunc.parametrize(&quot;source&quot;, source, indirect=True)<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp; if 'rped_source_only' in metafunc.funcargnames:<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; metafunc.parametrize(&quot;rped_source_only&quot;, source, indirect=True)<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>&nbsp;&nbsp;&nbsp;<o:p></o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='line-height:13.5pt;background:white;vertical-align:baseline'><span style='font-size:10.5pt;font-family:"Arial","sans-serif";color:black'>Chris<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA><o:p>&nbsp;</o:p></span></p></div></body></html>
<pre>The information contained in this electronic mail transmission 
may be privileged and confidential, and therefore, protected 
from disclosure. If you have received this communication in 
error, please notify us immediately by replying to this 
message and deleting it from your computer without copying 
or disclosing it.