Files
RustPython/extra_tests
youknowdot d3ff1eb5ea Keep module cache entries present during import reordering (#8948)
* Reorder the module cache atomically during imports

Add a private exact-dict move primitive and importlib dispatcher so shutdown-order updates never temporarily remove a module. Preserve current values and custom-mapping fallback behavior; validate reentrant equality probe witnesses, invalidate layout caches, and compact moved entries.

Cover all four existing bootstrap reorder sites, including legacy-loader cleanup. Add deterministic trace-window, loader replacement/removal, reentrancy, cache, iterator and compaction regressions. The private native primitive uses true-move semantics; it does not promise arbitrary pop/set callback equivalence.

Assisted-by: Codex:model-version-unavailable

* Keep atomic import regression compatible with modern bootstrap

Run legacy-loader cases when the bootstrap exposes that helper, preserving all four 3.14 paths and the two remaining 3.15 paths. Always retain modern load and exec regressions.

Assisted-by: Codex:model-version-unavailable

* Keep the copied bootstrap unchanged in the native relocation PR

Restore the exact CPython 3.14 bootstrap and retain only the private exact-dict relocation primitive and its direct native regressions. Remove the PR-added callback integration tests while preserving native helper assertions. This prepares a primitive only; imports do not call it and the import race remains unresolved.

Assisted-by: Codex:model-version-unavailable
2026-10-05 20:48:57 +09:00
..
2022-07-17 03:25:34 +09:00
2025-12-12 22:46:39 +09:00

Test snippets

This directory contains two sets of test snippets which can be run in Python. The snippets/ directory contains functional tests, and the benchmarks/ directory contains snippets for use in benchmarking RustPython's performance.

Setup

Our testing depends on pytest, which you can install using pip.

Running

Simply run pytest -v in this directory, and the tests should run (and hopefully pass). If it hangs for a long time, that's because it's building RustPython in release mode, which should take less time than it would to run every test snippet with RustPython compiled in debug mode.