From d9ede1bac20b05d5017681a8d8df9136eb878bcb Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 25 Feb 2016 20:02:34 -0300 Subject: [PATCH] Add test for unconditional skip with reason --- testing/test_skipping.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/testing/test_skipping.py b/testing/test_skipping.py index 6683aa200..3464974e0 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -551,14 +551,17 @@ class TestSkipif: pytest_runtest_setup(item)) assert x.value.msg == "condition: hasattr(os, 'sep')" - - def test_skipif_reporting(self, testdir): + @pytest.mark.parametrize('params', [ + '"hasattr(sys, \'platform\')"', + 'True, reason="invalid platform"', + ]) + def test_skipif_reporting(self, testdir, params): p = testdir.makepyfile(test_foo=""" import pytest - @pytest.mark.skipif("hasattr(sys, 'platform')") + @pytest.mark.skipif(%(params)s) def test_that(): assert 0 - """) + """ % dict(params=params)) result = testdir.runpytest(p, '-s', '-rs') result.stdout.fnmatch_lines([ "*SKIP*1*test_foo.py*platform*",