pytest.skip() does not work with testing.condition
See original GitHub issueTest code:
import unittest
import pytest
from chainer.testing import condition
class TestAaa(unittest.TestCase):
@condition.retry(32)
def test_aaa(self):
pytest.skip('aaa')
assert False
Result:
________________________________________________________ TestAaa.test_aaa ________________________________________________________
chainer/testing/condition.py:74: in wrapper
fail()
chainer/testing/condition.py:51: in fail
instance.fail(msg)
E AssertionError:
E Fail: 32, Success: 0
E
E The first error message:
E Traceback (most recent call last):
E File "/data/work/w/repos/chainer/chainer/testing/condition.py", line 60, in <lambda>
E lambda: f(ins, *args[1:], **kwargs),
E File "/data/work/w/repos/chainer/tests/chainer_tests/test_aaa.py", line 9, in test_aaa
E pytest.skip('aaa')
E File "/home/niboshi/anaconda/anaconda3/lib/python3.6/site-packages/_pytest/outcomes.py", line 72, in skip
E raise Skipped(msg=msg)
E Skipped: aaa
==================================================== 1 failed in 0.65 seconds ====================================================
After removing retry
:
=================================================== 1 skipped in 0.60 seconds ====================================================
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
How to use skip and xfail to deal with tests that cannot succeed
A skip means that you expect your test to pass only if some conditions are met, otherwise pytest should skip running the test...
Read more >How do I disable a test using pytest? - Stack Overflow
Another useful thing is to skipif using a function call. You can get the function to return a dictionary containing condition and reason...
Read more >How to skip a test case based on condition using PyTest?
If you wish to skip something conditionally then you can use skipif instead. Here is an example of marking a test function to...
Read more >Pytest options - how to skip or run specific tests - qavalidation
Pytest provides an option as skipif to use a condition to skip a test, if the condition evaluates to true, then only test...
Read more >pytest.mark.skipif not skiping the test if the condition is True
I added a boolean flag variable in the test suit as "test_flag" and assigned a value as False initially. If any dependant test...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s fix
chainer.testing
to pass-throughunittest.case.SkipTest
exception, so that we can use the standardself.skipTest()
until the discussion in #4557 has settled.It’s better to fix
condition
and allowpytest.skip()
. https://github.com/cupy/cupy/pull/2483#discussion_r327523206