Add mcoplib mcoplib testall script relative paths#56
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the path configurations in benchmark/testall.py to be absolute and relative to the script's directory, and adds a corresponding unit test. Feedback on the changes includes addressing a potential compatibility issue in the new test with Python versions older than 3.9 due to the use of Path.is_relative_to, and correcting a typo in the output filename teslalloutput.txt.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| assert os.path.isabs(path) | ||
| assert Path(path).resolve().is_relative_to(script_dir) |
There was a problem hiding this comment.
The is_relative_to method on pathlib.Path was introduced in Python 3.9. If this project is run or tested in environments using Python 3.8 or older (which is common in some GPU/CUDA docker containers), this test will raise an AttributeError and fail.
To ensure backward compatibility with Python 3.8, you can use a compatible path comparison such as checking if the resolved path is equal to script_dir or if script_dir is in its parent directories.
| assert os.path.isabs(path) | |
| assert Path(path).resolve().is_relative_to(script_dir) | |
| assert os.path.isabs(path) | |
| resolved_path = Path(path).resolve() | |
| assert resolved_path == script_dir or script_dir in resolved_path.parents |
| CONFIG_DIR = os.path.join(SCRIPT_DIR, "config") | ||
| RUNNERS_DIR = os.path.join(SCRIPT_DIR, "runners") | ||
| TARGET_SCRIPT = os.path.join(SCRIPT_DIR, "mcoplib_mxbenchmark_ops.py") | ||
| OUTPUT_FILE = os.path.join(SCRIPT_DIR, "teslalloutput.txt") |
Summary
Validation
Review notes