monty 0.0.21

A sandboxed, snapshotable Python interpreter written in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Verify that ModuleNotFoundError is raised when an unknown module import is actually executed
# (not guarded by TYPE_CHECKING)

condition = True
if condition:
    import nonexistent_at_runtime

"""
TRACEBACK:
Traceback (most recent call last):
  File "import__runtime_error_when_executed.py", line 6, in <module>
    import nonexistent_at_runtime
ModuleNotFoundError: No module named 'nonexistent_at_runtime'
"""