rspec/rules/S1607/python/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

59 lines
1.6 KiB
Plaintext

== 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
[source,python]
----
import unittest
class MyTest(unittest.TestCase):
@unittest.skip # Noncompliant
def test_something(self): ...
----
=== Compliant solution
[source,python]
----
import unittest
class MyTest(unittest.TestCase):
@unittest.skip("need to fix something")
def test_something(self): ...
----
== Resources
https://docs.python.org/3/library/unittest.html#skipping-tests-and-expected-failures[Unittest documentation - skipping tests and expected failures]
https://docs.pytest.org/en/latest/how-to/skipping.html#skipping-test-functions[Pytest documentation - skipping test functions]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Provide a reason for skipping this test.
=== Highlighting
Primary:
* the skip annotation or method call (if no argument is provided)
* the empty string literal (if an empty string is provided as argument)
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]