[Tests] Reorganize tests/ into ops/<family>, models, system#235
Closed
YWHyuk wants to merge 1 commit into
Closed
Conversation
73ab1b4 to
c08e1dc
Compare
dd28da3 to
bf722c8
Compare
c08e1dc to
5ca0455
Compare
tests/ was a flat mix of op-level files, single-file model tests, and
multi-file model directories with inconsistent capitalization. This PR
introduces a hierarchy:
tests/
_pytorchsim_utils.py
ops/
elementwise/ reduce/ gemm/ conv/ attention/
view/ sort/ sparsity/ misc/ fusion/
models/
DeepSeek/ Diffusion/ Llama/ MLP/ MoE/
MobileNet/ Mixtral8x7B/ Yolov5/
test_mlp.py test_resnet.py test_single_perceptron.py
test_transformer.py test_vit.py
system/
test_eager.py test_hetro.py test_scheduler.py
test_stonne.py test_vectorops.py
Mixtral_8x7B renamed to Mixtral8x7B for consistency with the other
PascalCase model dirs. Existing single-file model dirs are kept as
dirs (they may grow companion files like the Mixtral model.py).
All file moves use git mv to preserve history. External path
references rewritten across .github/workflows/pytorchsim_test.yml,
README.md, CLAUDE.md, .github/ISSUE_TEMPLATE/bug_report.md, and the
scripts/{sparsity,stonne}_experiment/ shell scripts.
Cross-test imports updated to drop the `tests.` prefix (because PR #234
puts `<repo>/tests` on sys.path[0] to avoid the ultralytics top-level
`tests` package collision):
- tests/system/test_hetro.py
- tests/system/test_scheduler.py
- tests/system/test_vectorops.py
- tests/ops/sparsity/test_sparsity.py
__init__.py added to each new subdir so e.g. `from ops.elementwise.test_add
import test_vectoradd` resolves.
Six files (test_resnet, test_vit, test_stonne, test_sparse_core,
test_gqa, test_diffusion) had their `sys.path.append` inside an
`if __name__ == "__main__":` block, which made the PR-A migration
script insert the import at the wrong indent level. Moved the
sys.path/import block to module top.
Sample-verified locally on tests/ops/elementwise/test_add.py and
tests/ops/fusion/test_matmul_vector.py (both pass) plus import-only
checks on the cross-import files.
Stacks on top of PR #234 (tests/_pytorchsim_utils.py extraction).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bf722c8 to
0549297
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reorganizes
tests/from a flat mix of op-level files, single-file model tests, and inconsistently-cased model directories into a 3-level hierarchy:Mixtral_8x7B→Mixtral8x7Bfor consistency. Existing single-file model dirs (Llama, DeepSeek, ...) are kept as dirs since they may grow companion files like the Mixtralmodel.py.All file moves use
git mvto preserve history.What was rewired
.github/workflows/pytorchsim_test.yml,README.md,CLAUDE.md,.github/ISSUE_TEMPLATE/bug_report.md,scripts/{sparsity,stonne}_experiment/*.sh.tests/system/test_hetro.py,tests/system/test_scheduler.py,tests/system/test_vectorops.py,tests/ops/sparsity/test_sparsity.pynow use fully qualifiedtests.<group>.<file>imports.__init__.pyadded to every new subdir sofrom tests.ops.X.test_Y import ...resolves.from tests._utils import test_resultat column 0 even though their originalsys.path.appendwas indented inside anif __name__ == "__main__":block. Moved the import/path-append to the module top.Verification
Sample-ran 5 moved tests (one per group):
tests/ops/elementwise/test_add.py,tests/ops/gemm/test_matmul.py,tests/ops/view/test_transpose2D.py,tests/ops/sort/test_sort.py,tests/ops/fusion/test_matmul_vector.py— all pass. Import-only sanity for the 3 cross-import files (test_sparsity, test_vectorops, test_hetro).Dependency
Stacks on PR #234 (the
tests/_utils.pyextraction). When #234 merges, this PR can be retargeted todevelop.🤖 Generated with Claude Code