Skip to content

test(rust): move large unit tests out of implementation files - #328

Draft
nachiketb-nvidia wants to merge 1 commit into
mainfrom
agent/extract-rust-unit-tests
Draft

test(rust): move large unit tests out of implementation files#328
nachiketb-nvidia wants to merge 1 commit into
mainfrom
agent/extract-rust-unit-tests

Conversation

@nachiketb-nvidia

Copy link
Copy Markdown
Contributor

What

Moves the largest inline Rust unit-test modules into sibling *_tests.rs files while keeping each module registered as mod tests through #[path = "..."].

Extracted files:

  • crates/libsy/src/algorithms/util/affinity.rs -> affinity_tests.rs
  • crates/switchyard-translation/src/helpers.rs -> helpers_tests.rs
  • crates/libsy/src/algorithms/stage.rs -> stage_tests.rs
  • crates/libsy/src/algorithms/rand.rs -> rand_tests.rs
  • crates/libsy/src/core/classifier.rs -> classifier_tests.rs

Why

These were the obvious inline-test-heavy Rust files where test LoC was much larger than implementation LoC. Keeping the tests in sibling files makes the implementation files easier to read without changing test visibility or behavior.

How

Each implementation file now ends with:

#[cfg(test)]
#[path = "<name>_tests.rs"]
mod tests;

Because the external file is still compiled as the same child tests module, the moved tests retain the same super::* access to private implementation details. No test macros or new abstraction layer were added.

Validation

  • cargo fmt --all --check
  • cargo test -p switchyard-libsy
  • cargo test -p switchyard-translation
  • commit hooks: cargo fmt, cargo clippy, commitlint

Signed-off-by: nachiketb <nachiketb@nvidia.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://NVIDIA-NeMo.github.io/Switchyard/pr-preview/pr-328/

Built to branch gh-pages at 2026-08-07 16:50 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant