Files
rustytorch/crates/specialized/rtx-sklearn-py/TEST_INSTRUCTIONS.md
T
2026-03-04 00:08:42 +00:00

1.5 KiB

Testing Instructions for rtx-sklearn-py

Running Tests

Due to PyO3's extension-module feature conflicting with test linking, tests must be run with the feature disabled:

# Run all tests
cargo test -p rtx-sklearn-py --no-default-features --features gpu,async

# Run a specific test
cargo test -p rtx-sklearn-py --no-default-features --features gpu,async test_name

# Compile tests without running
cargo test -p rtx-sklearn-py --no-default-features --features gpu,async --no-run

Why This is Needed

The extension-module feature in PyO3 is required for building Python extension modules (.so files) but prevents linking against Python libraries during testing. By disabling it for tests, we can:

  1. Compile and run Rust unit tests
  2. Test internal logic without Python runtime
  3. Perform integration testing

Python Integration Tests

For full end-to-end testing of the Python API, use pytest:

# Build the extension module first
maturin develop

# Run Python tests
pytest tests/python/

Test Structure

  • tests/basic_test.rs - Basic compilation tests
  • tests/integration_test.rs - Module structure and error handling tests
  • tests/tdd_comprehensive_test.rs - Placeholder for future comprehensive tests
  • tests/tdd_wrapper_test.rs - Wrapper smoke tests
  • tests/test_simple_classifiers.rs - Classifier smoke tests

Note: Many tests are currently stubs or placeholders as the full PyO3 API requires Python runtime for proper testing.