-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Ignore PytestUnknownMark warning when generating docs #5234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
A lot of our examples use custom markers to make a point and showcase features, which generates a lot of warnings
Codecov Report
@@ Coverage Diff @@
## features #5234 +/- ##
=========================================
Coverage 96.14% 96.14%
=========================================
Files 115 115
Lines 26125 26125
Branches 2577 2577
=========================================
Hits 25118 25118
Misses 706 706
Partials 301 301Continue to review full report at Codecov.
|
Where do they show up? |
|
They show up in the docs themselves, when we run Here's an example diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst
index ff422c585..5509612a8 100644
--- a/doc/en/example/simple.rst
+++ b/doc/en/example/simple.rst
@@ -194,10 +194,16 @@ and when running it will see a skipped "slow" test:
collected 2 items
test_module.py .s [100%]
+
+ ============================= warnings summary =============================
+ $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/mark/structures.py:321
+ $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/mark/structures.py:321: PytestUnknownMarkWarning: Unknown pytest.mark.slow - is this a
typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
+ PytestUnknownMarkWarning,
+
+ -- Docs: https://docs.pytest.org/en/latest/warnings.html
========================= short test summary info ==========================
SKIPPED [1] test_module.py:8: need --runslow option to run
-
- =================== 1 passed, 1 skipped in 0.12 seconds ====================
+ ============= 1 passed, 1 skipped, 1 warnings in 0.12 seconds ==============
Or run it including the ``slow`` marked test:
@@ -212,7 +218,13 @@ Or run it including the ``slow`` marked test:
test_module.py .. [100%]
- ========================= 2 passed in 0.12 seconds =========================
+ ============================= warnings summary =============================
+ $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/mark/structures.py:321
+ $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/mark/structures.py:321: PytestUnknownMarkWarning: Unknown pytest.mark.slow - is this a
typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
+ PytestUnknownMarkWarning,
+
+ -- Docs: https://docs.pytest.org/en/latest/warnings.html
+ =================== 2 passed, 1 warnings in 0.12 seconds ===================
Writing well integrated assertion helpers
--------------------------------------------------
@@ -524,10 +536,16 @@ If we run this:
E assert 0
test_step.py:11: AssertionError
+ ============================= warnings summary =============================
+ $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/mark/structures.py:321
+ $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/mark/structures.py:321: PytestUnknownMarkWarning: Unknown pytest.mark.incremental - is
this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
+ PytestUnknownMarkWarning,
+
+ -- Docs: https://docs.pytest.org/en/latest/warnings.html
========================= short test summary info ==========================
XFAIL test_step.py::TestUserHandling::test_deletion
reason: previous test failed (test_modification)
- ============== 1 failed, 2 passed, 1 xfailed in 0.12 seconds ===============
+ ======== 1 failed, 2 passed, 1 xfailed, 1 warnings in 0.12 seconds =========
We'll see that ``test_deletion`` was not executed because ``test_modification``
failed. It is reported as an "expected failure".
@@ -640,7 +658,13 @@ We can run this:
E assert 0
a/test_db2.py:2: AssertionError
- ========== 3 failed, 2 passed, 1 xfailed, 1 error in 0.12 seconds ==========
+ ============================= warnings summary =============================
+ $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/mark/structures.py:321
+ $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/mark/structures.py:321: PytestUnknownMarkWarning: Unknown pytest.mark.incremental - is
this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
+ PytestUnknownMarkWarning,
+
+ -- Docs: https://docs.pytest.org/en/latest/warnings.html
+ ==== 3 failed, 2 passed, 1 xfailed, 1 warnings, 1 error in 0.12 seconds ====
The two test modules in the ``a`` directory see the same ``db`` fixture instance
while the one test in the sister-directory ``b`` doesn't see it. We could of course |
Given that our examples use a lot of custom marks, they end up generating a lot of warnings which are only noise in the documentation.