Skip to content

Commit

Permalink
[REF] tests: Support pdb to debug pylint checks (#517)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
moylop260 authored Jan 13, 2025
1 parent 8c9d998 commit a6db757
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,15 @@ def run_pylint(self, paths, extra_params: list | None = None, verbose=False, rcf

@staticmethod
def _run_pylint(args, out, reporter):
with _patch_streams(out):
with pytest.raises(SystemExit) as ctx_mgr:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
with pytest.raises(SystemExit) as ctx_mgr:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
if sys.gettrace() is None: # No pdb enabled
with _patch_streams(out):
Run(args, reporter=reporter)
else: # pdb enabled
Run(args, reporter=reporter)
return int(ctx_mgr.value.code)
return int(ctx_mgr.value.code)

def test_10_path_dont_exist(self):
"""test if path don't exist"""
Expand Down

0 comments on commit a6db757

Please sign in to comment.