You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works with trial, i.e. the test_skipThis() function gets marked as SKIPPED:
class MyTests(TestCase):
@skipIf(True, "skip reason")
def test_skipThis(self):
This does not work with trial, i.e. all the tests in the SkipAllTests class are executed instead of skipped.
@skipIf(True, "skip reason")
class SkipAllTests(TestCase):
def test_skipThisFirst(self):
print("Should never get here first")
def test_skipThisSecond(self):
print("Should never get here second")
It would be good to enhance trial to honor the @skipIf decorator on classes.
In the @skipIf implementation, two attributes are set unittest_skip and unittest_skip_why:
#!CommitTicketReference repository="" revision="52e7518232b5031ae38e1e477786a0afa761df9b"
Merge pull request #1272 from twisted/9829-rodrigc-trial
Allow @unittest.skipIf decorator to specify that a test class should be skipped
Author: rodrigc
Reviewer: adiroiban
Fixes: ticket:9829
The @unittest.skipIf decorator ( https://docs.python.org/3/library/unittest.html#skipping-tests-and-expected-failures ) instructs a test runner such as pytest or unittest to skip a specific test function.
This partially works with trial.
This works with trial, i.e. the test_skipThis() function gets marked as SKIPPED:
This does not work with trial, i.e. all the tests in the SkipAllTests class are executed instead of skipped.
It would be good to enhance trial to honor the @skipIf decorator on classes.
In the @skipIf implementation, two attributes are set unittest_skip and unittest_skip_why:
See: skipIf implementation
In the unittest runner, these attributes are checked:
unittest implementation checks attributes
The pytest runner also checks these attributes:
pytest implementation checks attribute
So trial should be enhanced to behave like unittest and pytest.
Searchable metadata
The text was updated successfully, but these errors were encountered: