All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.py.rules.python.S1607.html Maven / Gradle / Ivy

There is a newer version: 4.23.0.17664
Show newest version

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

Pytest documentation - skipping test functions





© 2015 - 2024 Weber Informatics LLC | Privacy Policy