Skip to content

Commit a6db757

Browse files
authored
[REF] tests: Support pdb to debug pylint checks (#517)
Before of this commit, if you add a "pdb" you can not see the pdb input because it is redirected With this commit you are able to use pdb bypassing the redirect if sys.gettrace is enabled (pdb enabled)
1 parent 8c9d998 commit a6db757

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/test_main.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,15 @@ def run_pylint(self, paths, extra_params: list | None = None, verbose=False, rcf
125125

126126
@staticmethod
127127
def _run_pylint(args, out, reporter):
128-
with _patch_streams(out):
129-
with pytest.raises(SystemExit) as ctx_mgr:
130-
with warnings.catch_warnings():
131-
warnings.simplefilter("ignore")
128+
with pytest.raises(SystemExit) as ctx_mgr:
129+
with warnings.catch_warnings():
130+
warnings.simplefilter("ignore")
131+
if sys.gettrace() is None: # No pdb enabled
132+
with _patch_streams(out):
133+
Run(args, reporter=reporter)
134+
else: # pdb enabled
132135
Run(args, reporter=reporter)
133-
return int(ctx_mgr.value.code)
136+
return int(ctx_mgr.value.code)
134137

135138
def test_10_path_dont_exist(self):
136139
"""test if path don't exist"""

0 commit comments

Comments
 (0)