Repository navigation
Resolve tree_test golden-data paths relative to the test file - #130
Open
rootkiller6788 wants to merge 2 commits into
Open
rootkiller6788 wants to merge 2 commits into
rootkiller6788 wants to merge 2 commits into
Conversation
The golden trees under test_data/ were opened with paths relative to the process working directory (../mctx/_src/tests/test_data/...), which only resolve when pytest runs from a directory below the repo root (test.sh cd's into a _testing dir for this reason). Running the file from the repo root, e.g. `python -m pytest mctx/_src/tests/tree_test.py`, therefore failed on all four parametrized cases with FileNotFoundError. Resolve the data directory from os.path.dirname(__file__) so the tests can run from any working directory, both in the source tree and from an installed package (the wheel ships test_data/).
_produce_prediction_output split rng_key three ways twice in a row. The first assignment is dead code: jax.random.split is pure and both calls use the same key, so the second result is identical to the first. Keep a single split.
rootkiller6788
marked this pull request as ready for review
October 12, 2026 15:47
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.
The tree tests can't currently be run the way CONTRIBUTING suggests picking affected tests individually:
python -m pytest mctx/_src/tests/tree_test.pyfrom the repo root fails on all four parametrized cases with FileNotFoundError.The golden JSON trees are opened via paths like
../mctx/_src/tests/test_data/muzero_tree.json, which only resolve when pytest is launched from a directory below the repo root — that's why test.sh cd's into a_testing/dir. This change resolves the data directory from the test file location instead, so the tests run from any working directory, both in the source tree and from an installed wheel (the package ships test_data/). CI via test.sh is unaffected.While there I also removed a duplicated
jax.random.split(rng_key, 3)line in_produce_prediction_output— same pure-function call twice, so the first assignment was dead code.Verified:
python -m pytest mctx/_src/tests/tree_test.py -qfrom the repo root now passes 4/4 (previously 4x FileNotFoundError).