There is a button "Show Ignored" in Pycharm test run window. I wonder, how to mark some test as ignored?
With just Python unittest
, you can decorate a test to be skipped with @skip
. From unittest — Unit testing framework — Python 2 or unittest — Unit testing framework — Python 3:
class MyTestCase(unittest.TestCase):
@unittest.skip("demonstrating skipping")
def test_nothing(self):
self.fail("shouldn't happen")
@unittest.skipIf(mylib.__version__ < (1, 3),
"not supported in this library version")
def test_format(self):
# Tests that work for only a certain version of the library.
pass
@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
def test_windows_support(self):
# windows specific testing code
pass
I assume PyCharm is showing you the skipped tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With