PY-79922 ensure there're no warnings

make sure shell completion initialization
logic throws no warnings

per `pytest` doc https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests


(cherry picked from commit 31f69636b78ee135082d6087788578c191e2e25f)

IJ-MR-158254

GitOrigin-RevId: 1f51e49050ddc7feb1e4ca73b34aab228079d3a9
This commit is contained in:
Pavel Karateev
2025-03-24 17:47:41 +01:00
committed by intellij-monorepo-bot
parent 7de49cf1da
commit e4b723f689

View File

@@ -2,6 +2,7 @@ import os
import sys
import time
import unittest
import warnings
import pytest
@@ -9,6 +10,8 @@ pytest.importorskip('IPython')
from _pydev_bundle.pydev_stdin import StdIn
from _pydev_bundle.pydev_localhost import get_localhost
from _pydev_bundle.pydev_ipython_console_011 import PyDevTerminalInteractiveShell
from _pydev_bundle.pydev_ipython_completer import init_shell_completer
from _pydev_comm.pydev_rpc import make_rpc_client
from _pydevd_bundle import pydevd_io
from _pydevd_bundle.pydevd_constants import IS_PY2
@@ -27,6 +30,18 @@ def eq_(a, b):
raise AssertionError('%s != %s' % (a, b))
@pytest.fixture
def assert_no_warnings():
with warnings.catch_warnings():
warnings.simplefilter('error')
yield
def test_no_deprecations(assert_no_warnings):
shell = PyDevTerminalInteractiveShell()
init_shell_completer(shell)
class TestBase(unittest.TestCase):
def setUp(self):