Files
RustPython/extra_tests
Kwak Byoung Min 62f4c9895a Add StringIO newline tracking (#8539)
* Report observed StringIO newline types

Constraint: Match CPython StringIO newline reporting without changing configured newline translation.
Rejected: Separate newline-tracking representation | reuse the existing SeenNewline bitflags.
Confidence: high
Scope-risk: narrow
Directive: Keep observed newline state separate from the configured newline mode.
Tested: prek run --all-files; test_memoryio; cargo clippy -p rustpython-vm --lib -- -D warnings; workspace tests excluding the macOS C-API baseline SIGSEGV.
Not-tested: Full macOS workspace suite is blocked by the existing rustpython-capi SIGSEGV; the Linux suite is running.
Assisted-by: Codex:gpt-5.6-sol

* Preserve StringIO state boundaries

Reset observed newline state when StringIO is reinitialized and keep the property subject to closed-stream checks.

Constraint: Match CPython StringIO reinitialization and closed-stream behavior.
Rejected: Returning stale or cached newline state | violates StringIO lifecycle semantics.
Confidence: high
Scope-risk: narrow
Directive: Keep observed newline state tied to the current open StringIO contents.
Tested: cargo test --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher; cargo run --release -- extra_tests/snippets/stdlib_io_stringio.py; cargo run --release -- -m test test_memoryio; prek run --all-files; cargo clippy -p rustpython-vm --lib -- -D warnings.
Assisted-by: Codex:gpt-5.6-sol
2026-08-18 12:38:16 +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.