2023-05-03 11:06:20 +02:00
== Why is this an issue?
2020-12-21 15:38:52 +01:00
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.
2021-02-02 15:02:10 +01:00
2021-01-27 13:42:22 +01:00
This rule raises an issue for each skipped test with \"``++unittest.skip++``" or \"``++pytest.mark.skip++``" without providing a reason argument.
2020-12-21 15:38:52 +01:00
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2020-12-21 15:38:52 +01:00
2022-02-04 17:28:24 +01:00
[source,python]
2020-12-21 15:38:52 +01:00
----
import unittest
class MyTest(unittest.TestCase):
@unittest.skip # Noncompliant
def test_something(self): ...
----
2023-05-03 11:06:20 +02:00
=== Compliant solution
2020-12-21 15:38:52 +01:00
2022-02-04 17:28:24 +01:00
[source,python]
2020-12-21 15:38:52 +01:00
----
import unittest
class MyTest(unittest.TestCase):
@unittest.skip("need to fix something")
def test_something(self): ...
----
2023-05-03 11:06:20 +02:00
== Resources
2020-12-21 15:38:52 +01:00
https://docs.python.org/3/library/unittest.html#skipping-tests-and-expected-failures[Unittest documentation - skipping tests and expected failures]
2021-02-02 15:02:10 +01:00
2021-04-28 18:08:03 +02:00
https://docs.pytest.org/en/latest/how-to/skipping.html#skipping-test-functions[Pytest documentation - skipping test functions]
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-09-20 15:38:42 +02:00
'''
== Implementation Specification
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== 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)
2021-09-20 15:38:42 +02:00
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]