File: test_qt_loaders.py

package info (click to toggle)
ipython 9.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 8,624 kB
  • sloc: python: 45,268; sh: 317; makefile: 168
file content (11 lines) | stat: -rw-r--r-- 367 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
import importlib
import pytest
from IPython.external.qt_loaders import ID


def test_import_denier():
    ID.forbid("ipython_denied_module")
    with pytest.raises(ImportError, match="disabled by IPython"):
        import ipython_denied_module
    with pytest.raises(ImportError, match="disabled by IPython"):
        importlib.import_module("ipython_denied_module")