[TIP] re-using markers in pytest in fixtures

holger krekel holger at merlinux.eu
Fri Mar 8 23:34:11 PST 2013


On Fri, Mar 08, 2013 at 17:18 -0500, Pella,Chris wrote:
> We have a use case where we are using markers to select tests based on target platforms.  In the same test suites we have to install different types of clients based on the target platform.  I would like to re-use the marker from the command line in fixtures or helper functions that install the client. I understand how to get the original command line argument from a request object passed to the fixture, but I'm wondering if there is a way to get access to an already-parsed list of markers,  for my convenience.

request.keywords maps markers names to MarkerInfo objects which you can iterate
on (there might be multiple same-named markers) and access args/kwargs respectively.

HTH,
holger



> 
> Thanks,
> Chris
> 
> 
> 
> 
> 
> 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.
> 
> 


> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python




More information about the testing-in-python mailing list