File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ Debugging
171171=========
172172
173173If the ``SPHINX_AUTOBUILD_DEBUG `` environment variable is present
174+ (regardless of its value)
174175and a file change is detected,
175176its path and the currently active ignore expressions are printed.
176177This is to help setting up the ignore expressions correctly.
Original file line number Diff line number Diff line change 1+ import os
2+
3+ import pytest
4+
15from sphinx_autobuild .filter import IgnoreFilter
26
37
@@ -72,3 +76,19 @@ def test_multiple_both():
7276 assert ignored ("foo/random.txt" )
7377 assert ignored ("foo/module.pyc" )
7478 assert ignored ("bar/__pycache__/file.pyc" )
79+
80+
81+ @pytest .mark .parametrize ("is_debug" , [True , False ])
82+ def test_debug (is_debug , capfd ):
83+ if is_debug :
84+ # also "0" is considered to mean "print debug output":
85+ os .environ ["SPHINX_AUTOBUILD_DEBUG" ] = "0"
86+ else :
87+ del os .environ ["SPHINX_AUTOBUILD_DEBUG" ]
88+ ignore_handler = IgnoreFilter ([], [])
89+ ignore_handler ("dummyfile" )
90+ captured = capfd .readouterr ()
91+ if is_debug :
92+ assert "SPHINX_AUTOBUILD_DEBUG" in captured .out
93+ else :
94+ assert "SPHINX_AUTOBUILD_DEBUG" not in captured .out
You can’t perform that action at this time.
0 commit comments