org.sonar.l10n.py.rules.python.S1607.html Maven / Gradle / Ivy
Why is this an issue?
When a test fails due, for example, to infrastructure issues, you might want to ignore it temporarily. But without some kind of notation about why
the test is being ignored, it may never be reactivated. Such tests are difficult to address without comprehensive knowledge of the project, and end up
polluting their projects.
This rule raises an issue for each skipped test with "unittest.skip
" or "pytest.mark.skip
" without providing a reason
argument.
Noncompliant code example
import unittest
class MyTest(unittest.TestCase):
@unittest.skip # Noncompliant
def test_something(self): ...
Compliant solution
import unittest
class MyTest(unittest.TestCase):
@unittest.skip("need to fix something")
def test_something(self): ...
Resources
Unittest documentation - skipping tests and expected
failures
© 2015 - 2024 Weber Informatics LLC | Privacy Policy