Tuesday 15 September 2015

testing - Mark test as skipped during test execution -


I have a test that depends on the persistence of fixture . It's almost his code:

  def test_optional_cool_feature (stability): If there is no stability. Supports_cool_feature (): Return cool_feature () == Expected_Security  

here emphasizes fixtures is a parametric fixtures which are present in the en variants and it has been declared @py.test.fixture (scope = "session", parameters = ["type 1" ...]) DF efx (request): if request.param = "type1": Return Type1 () elif ...

But it would also be nice to see it as a test in pySED output py.test When the output is left in Storm is against what does not support cool_feature Unfortunately, it can not be obtained with the @ py.test.mark.skipif (not the 'stability. Supports_cool_feature ()' ) Because stability still has a function at execution skipif , not the replacement test parameter.

Answer to my own question because I remembered part of skip That's what I want to say:

Skip mandatory from within a test or setup function

If for some reason you can not declare leave conditions You can leave a result from within the examination or setup code. Example:

  def test_function (): if not valid_config (): pytest.skip ("unsupported configuration")  

No comments:

Post a Comment