[TIP] combining markers in pytest
Pella,Chris
Chris.Pella at safenet-inc.com
Fri Oct 19 14:40:10 PDT 2012
I'm trying to find out if we can combine markers in a Boolean way using pytest. Let's say we have some tests that can be marked as 'regression', or 'smoke', or 'nightly_build'. We have some other tests that are platform-specific and we mark as linux_x86_32 , solaris_sparc_32 etc...
Is there a way to combine these so that we can say include a linux_x86_32 test as part of the nightly build?
If you stack the markers like below it will 'or' the markers so that it will always run if py.test -m nightly is used even if linux_x86_32 is not set:
@pytest.marker.nightly
@pytest.marker.linux_x86_32
def test_me():
...
What is the best way to select tests when there are multiple pre-conditions involved? Should we just be organizing test classes differently (this would involve code duplication and doesn't appeal) ? We are setting up automated testing using Jenkins over multiple client platforms and with multiple test targets (we make embedded systems), and want to designate different types of test runs.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20121019/c3518d7b/attachment.htm>
More information about the testing-in-python
mailing list